<?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";
}
}
preferences:
62.06 ms | 402 KiB | 5 Q