3v4l.org

run code in 300+ PHP versions simultaneously
<?php function writeXML( $data ) { foreach( $data as $key => $value ) { if ( preg_match('/^(.*) (.*)=(.*)$/', $key, $matches) != false ) { $xml->startElement( $matches[1] ); $xml->writeAttribute( $matches[2], $matches[3]); if( is_array( $value )) { $writeXML( $value ); $xml->endElement( ); continue; } $xml->text( $value ); $xml->endElement( ); } else { if( is_array( $value )) { $xml->startElement( $key ); $writeXML( $value ); $xml->endElement( ); continue; } echo $key. "\n"; $xml->writeElement( $key, $value ); } } } $name = 'item'; $xml = new XmlWriter(); $xml->openMemory(); $xml->startDocument( '1.0', 'utf-8' ); $xml->startElement( $name ); $data = array( "title" => 'test', "description" => 'test description', "pubDate" => '1999', "imdbid" => "", "MediaType" => "Movie", "moviePoster" => array ( "url" => 'bad&filename.jpg', ), "studio" => 'WB', "officialRating type=mpaa" => 'PG', "duration" => 120 "movieKeywords" => "", "moviePopularity scale=" => 4, "VideoType" => "movie", "country" => "United States", "language" => "en-us", "geoRestrictions" => '', //"dateAvailable" => $start_date, //"expDate" =>$end_date, "showCategory" => 'All', "sourceID" => 2222, "streamType" => "SD", "iOSAllowed" => 0, "subscription" => "no", "price" => 0.00, "videoURL" => "http://www.flixfling.com/movies/2222", ); writeXML($data);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.350.0130.05018.99
5.4.340.0050.03512.03
5.4.320.0140.03812.53
5.4.310.0060.03912.53
5.4.300.0090.03512.52
5.4.290.0090.03812.53
5.4.280.0060.03412.42
5.4.270.0050.03712.42
5.4.260.0090.03712.42
5.4.250.0080.03812.42
5.4.240.0070.03412.42
5.4.230.0080.04012.41
5.4.220.0050.04012.41
5.4.210.0040.03712.41
5.4.200.0070.03712.41
5.4.190.0050.03612.41
5.4.180.0070.03412.41
5.4.170.0050.03612.41
5.4.160.0060.03512.41
5.4.150.0050.03612.41
5.4.140.0050.03712.10
5.4.130.0110.03412.08
5.4.120.0050.03712.04
5.4.110.0070.03512.04
5.4.100.0020.04012.04
5.4.90.0030.03912.04
5.4.80.0050.03712.04
5.4.70.0070.03312.04
5.4.60.0040.03512.03
5.4.50.0070.03412.04
5.4.40.0050.03512.02
5.4.30.0060.03512.02
5.4.20.0040.03712.02
5.4.10.0050.04012.02
5.4.00.0060.04411.50
5.3.290.0060.04112.80
5.3.280.0070.03812.71
5.3.270.0070.03912.73
5.3.260.0060.03912.72
5.3.250.0050.03812.72
5.3.240.0050.03912.72
5.3.230.0070.03712.71
5.3.220.0060.03912.68
5.3.210.0080.03912.68
5.3.200.0060.03812.68
5.3.190.0040.03912.68
5.3.180.0090.03512.67
5.3.170.0060.03612.67
5.3.160.0050.03812.68
5.3.150.0060.03912.68
5.3.140.0070.03712.66
5.3.130.0070.04712.66
5.3.120.0080.05012.66
5.3.110.0090.04612.66
5.3.100.0120.04512.13
5.3.90.0100.05912.11
5.3.80.0120.05512.11
5.3.70.0060.04712.10
5.3.60.0040.04712.08
5.3.50.0100.04112.04
5.3.40.0070.04212.04
5.3.30.0080.04011.99
5.3.20.0070.04711.78
5.3.10.0070.04911.74
5.3.00.0120.04811.72
5.2.170.0090.0379.23
5.2.160.0070.0409.23
5.2.150.0100.0399.23
5.2.140.0070.0419.23
5.2.130.0030.0399.19
5.2.120.0040.0299.19
5.2.110.0030.0319.20
5.2.100.0040.0299.19
5.2.90.0040.0299.18
5.2.80.0030.0329.18
5.2.70.0040.0339.18
5.2.60.0050.0309.14
5.2.50.0060.0299.11
5.2.40.0070.0269.08
5.2.30.0040.0319.06
5.2.20.0060.0289.04
5.2.10.0030.0308.95
5.2.00.0060.0288.82
5.1.60.0010.0278.10
5.1.50.0030.0278.10
5.1.40.0040.0248.08
5.1.30.0080.0228.42
5.1.20.0040.0278.45
5.1.10.0050.0258.18
5.1.00.0010.0298.18
5.0.50.0030.0226.66
5.0.40.0040.0186.52
5.0.30.0040.0296.33
5.0.20.0030.0196.30
5.0.10.0040.0196.28
5.0.00.0050.0296.28
4.4.90.0010.0184.78
4.4.80.0030.0154.75
4.4.70.0030.0154.76
4.4.60.0010.0174.75
4.4.50.0040.0144.77
4.4.40.0050.0234.71
4.4.30.0040.0164.76
4.4.20.0020.0184.85
4.4.10.0010.0184.85
4.4.00.0030.0284.76
4.3.110.0020.0164.67
4.3.100.0040.0144.66
4.3.90.0030.0144.63
4.3.80.0060.0224.58
4.3.70.0020.0164.63
4.3.60.0040.0134.63
4.3.50.0040.0144.63
4.3.40.0020.0254.54
4.3.30.0010.0173.32
4.3.20.0030.0153.30
4.3.10.0030.0153.25
4.3.00.0030.0207.08

preferences:
144.58 ms | 1394 KiB | 7 Q