3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * Fundtion take array as arguments * print out the preformatted array. * * Prince Adeyemi * */ $data = array( 'first_name' => "John", 'last_name' => "Doe", 'address' => '123 Main St.', 'city' => 'Las Vegas', 'state' => 'NV', 'country' => 'USA', 'orderid' => 1234, 'item_desc' => 'Test order', 'item_price' => 29.99, 'shipping' => 2.99 ); process_order( $data ); function process_order( $data ) { if( count($data) > 0 ) { /** do something with array like order submission, registration etc. */ //display dynamic message to client echo "Processing order # " . $data['orderid'] . " for " . $data['first_name'] . "\n"; print_r( $data ); } else { print "No data received"; } }
based on o23QT
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.1
Processing order # 1234 for John Array ( [first_name] => John [last_name] => Doe [address] => 123 Main St. [city] => Las Vegas [state] => NV [country] => USA [orderid] => 1234 [item_desc] => Test order [item_price] => 29.99 [shipping] => 2.99 )