|
How to PHP function returns variables in arrayPHP function can get back a set of variables by using an array. Main idea is that a php function can returns any variable to the main script by using return statement.
Example:
function split_string($my_string) { $my_array = split(" ", $my_string); return $my_array; } // Now we can send a string to function split_string() as input $collect_array = split_string("We are the best");
In example we send ( as input ) a string to the php function split_string(). This string we will break by using split command and create an array. This array we will return to main php script.
Comments
Add your comment
|
![]() |
List of PHP articles
How to function return variables in array Smart utilities |
Webdesign (c) 2009 - 2018 Supremus.sk |