note 110976 deleted from functions.variable-functions by googleguy
| From: | googleguy@php.net | Date: | Wed, 02 Jan 2013 01:41:44 +0000 |
| Subject: | note 110976 deleted from functions.variable-functions by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192727@lists.php.net to get a copy of this message | ||
Note Submitter: spam at wikicms dot com
----
I hope it help for someone..
<?php
function sum( $a, $b ) {
$c = $a + $b;
return $c;
}
$json_request = '{"action":"sum","a":144,"b":12}';
$obj = json_decode($json_request);
$action = $obj->action; // now variable $action uses as function sum()
echo $action( $obj->a, $obj->b ); //output 156 (144+12)