PHP ʖ²ἯTH
º/A
Ղ 13. º¯ʽ
function takes_array($input) {echo "$input[0] + $input[1] = ", $input[0]+$input[1];}
function add_some_extra( $string) {$string .= 'and something extra.';} $str = 'This is a string, '; add_some_extra($str); echo $str; // outputs 'This is a string, and something extra.'
function makecoffee ($type = "cappuccino") {return "Making a cup of $type.\n";} echo makecoffee (); echo makecoffee ("espresso");
Making a cup of cappuccino. Making a cup of espresso.
function makeyogurt ($type = "acidophilus", $flavour) {return "Making a bowl of $type $flavour.\n";} echo makeyogurt ("raspberry"); // won't work as expected
Warning: Missing argument 2 in call to makeyogurt() in /usr/local/etc/httpd/htdocs/php3test/functest.html on line 41 Making a bowl of raspberry.
function makeyogurt ($flavour, $type = "acidophilus") {return "Making a bowl of $type $flavour.\n";} echo makeyogurt ("raspberry"); // works as expected
Making a bowl of acidophilus raspberry.
º/A
ưµ㼯A
º¯ʽ
ɏһ¼¶
·µ»ؖµ