3v4l.org

run code in 300+ PHP versions simultaneously
<?php $item = array( array( "external_ref" => 12345, "style" => "mens", "size" => "Medium", "color" => "White", "print_location" => "FRONT", "print_x_offset" => "0", "print_y_offset" => "0", "quantity" => 1, "external_url" => "url.png", "external_thumbnail_url" => "url.jpg" ) ); //The JSON data. $jsonData = array( "external_ref"=> 12345, "sale_datetime" => "2016-03-01 22:09:00", "customer_name" => "Foo Bar", "shipping_address_1" => "123 Test Street", "shipping_address_2" => "", "shipping_address_3" => "City", "shipping_address_4" => "County", "shipping_postcode" => "AB12 3AB", "shipping_country" => 'England', "shipping_country_code" => "GB", "shipping_method" => "STANDARD", "phone" => "01234567890", "items" => $item ); echo json_encode($jsonData, true);
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.13
{"external_ref":12345,"sale_datetime":"2016-03-01 22:09:00","customer_name":"Foo Bar","shipping_address_1":"123 Test Street","shipping_address_2":"","shipping_address_3":"City","shipping_address_4":"County","shipping_postcode":"AB12 3AB","shipping_country":"England","shipping_country_code":"GB","shipping_method":"STANDARD","phone":"01234567890","items":[{"external_ref":12345,"style":"mens","size":"Medium","color":"White","print_location":"FRONT","print_x_offset":"0","print_y_offset":"0","quantity":1,"external_url":"url.png","external_thumbnail_url":"url.jpg"}]}

preferences:
146.86 ms | 410 KiB | 5 Q