Function in PHP
syntax: function functionname( $arg1, $arg2) { // some statements goes here } function functionname($arg1, $arg2='Bob'){ // some statements goes here return $somevalues; } Other things to know returns numeric format example code : return number_format($total, 2); returns an Array ex.: function some_function() { return array('val1', 'val2'); } list ($var1, $var2) = some_function(); global variables global variables are access from with-in a function via the key word global plus(+) the actual variable name to be accessed ex.: function someglobal() { global $total; . . . . . } |

