3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('REST_URL', 'https://api.nizex.com/submitorder'); //Defines the url and function to be called. define('API_KEY', 'my-api-key'); //API Key from Lizzy $orders = array("Orders" => array(0 => array( "OrderNumber" => "825713", //Order number from the web store "Date" => "2013-02-12", //Date the order was created "Time" => "15:28", //Time the order was created "InvoiceNumber" => "", //Invoice number from the web store, "" if not applicable "Tax" => 1.99, //Tax amount (Format 0.00) "ShippingCost" => 5.99, //Shipping cost (Format 0.00) "Total" => 28.83, //Total cost of the order (Format 0.00) "PaymentMethod" => "Visa", //Payment method used by customer. "ShippingAddress" => array( "FirstName" => "Noel", //Ship to first name "LastName" => "Jacques", //Ship to last name "EmailAddress" => "njacques@nizex.com", //Ship to email address "CompanyName" => "Nizex Inc.", //Ship to company name "Phone" => "6783594184", //Ship to phone number "Address" => "1735 Pennsylvania Ave.", //Ship to address "Address2" => "", //Ship to address 2 "City" => "McDonough", //Ship to city "State" => "GA", //Ship to state (two letter abbreviation only) "ZipCode" => "30353", //Ship to zip code "Country" => "US", //Ship to county (two letter abbreviation only) "Method" => "Priority Mail" //Shipping method (ex. FedEx Next Day, etc...) ), "BillingAddress" => array( "FirstName" => "Noel", //Bill to first name "LastName" => "Jacques", //Bill to last name "EmailAddress" => "njacques@nizex.com", //Bill to email address "CompanyName" => "Nizex Inc.", //Bill to company name "Phone" => "6783594184", //Bill to phone number "Address" => "1735 Pennsylvania Ave.", //Bill to address "Address2" => "", //Bill to address 2 "City" => "McDonough", //Bill to city "State" => "GA", //Bill to state (two letter abbreviation only) "ZipCode" => "30353", //Bill to zip code "Country" => "US", //Bill to county (two letter abbreviation only) ), "OrderItems" => array( 0 => array( "ProductID" => "01-0013", //Product part number "ProductCode" => "PUN", //Product brand code "ProductDesc" => "Oil Filter, Kawasaki", //Product description "Price" => "6.95", //Price presented to customer (Format 0.00) "Quantity" => "2", //Quantity ordered "DropShip" => "True" //Flag item as a drop ship item. ), 1 => array( "ProductID" => "01-0021", //Product part number "ProductCode" => "PUN", //Product brand code "ProductDesc" => "Oil Filter, Honda", //Product description "Price" => "6.95", //Price presented to customer (Format 0.00) "Quantity" => "1" //Quantity ordered ))))); $orders = json_encode($orders); //Setup the curl request $qrystr = "&APIKey=".API_KEY."&Payload=$orders"; echo $qrystr;
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
&APIKey=my-api-key&Payload={"Orders":[{"OrderNumber":"825713","Date":"2013-02-12","Time":"15:28","InvoiceNumber":"","Tax":1.99,"ShippingCost":5.99,"Total":28.83,"PaymentMethod":"Visa","ShippingAddress":{"FirstName":"Noel","LastName":"Jacques","EmailAddress":"njacques@nizex.com","CompanyName":"Nizex Inc.","Phone":"6783594184","Address":"1735 Pennsylvania Ave.","Address2":"","City":"McDonough","State":"GA","ZipCode":"30353","Country":"US","Method":"Priority Mail"},"BillingAddress":{"FirstName":"Noel","LastName":"Jacques","EmailAddress":"njacques@nizex.com","CompanyName":"Nizex Inc.","Phone":"6783594184","Address":"1735 Pennsylvania Ave.","Address2":"","City":"McDonough","State":"GA","ZipCode":"30353","Country":"US"},"OrderItems":[{"ProductID":"01-0013","ProductCode":"PUN","ProductDesc":"Oil Filter, Kawasaki","Price":"6.95","Quantity":"2","DropShip":"True"},{"ProductID":"01-0021","ProductCode":"PUN","ProductDesc":"Oil Filter, Honda","Price":"6.95","Quantity":"1"}]}]}
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/v9fqR on line 58
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/v9fqR on line 58
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/v9fqR on line 58
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/v9fqR on line 58

preferences:
261.61 ms | 401 KiB | 351 Q