Convert datetime to ISO8601 in PHP

iso8601

applies to representations and formats of dates in the Gregorian (and potentially proleptic Gregorian) calendar.
How to convert datetime into iso8601 using PHP coding language. Simple as that: