In fact, you did not return any value to your function, so it really worked correctly.
You need to add, for example, the next element at the end of the function
<?php function saveorder($orderid,$txnid,$date,$amount) //function foo($arg_1, $arg_2, $arg_n) { $a_str = array( "orderid"=>"175", "txnid"=>"RC456456456", "date"=>"54156456465", "amount"=>"109$" ); $file = 'order.dat'; $contents = implode("|", $a_str); $contents .= PHP_EOL . PHP_EOL; res = file_put_contents($file, $contents); if(res){ return true; } else { return false; } } echo "function will return=".saveorder($orderid); ?>
source share