PHP programming - English PHP programming - Slovak
Main page | C# section | VB6 section | PHP section | MySQL section |

How to PHP function returns variables in array

PHP 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.


    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.


There are no comments for this article.

Add your comment, and be first.

Add your comment
User language:



Human verification:
Number 179 is

PHP programming - transparent separator

List of PHP articles

How to function return variables in array

Smart utilities

Webdesign (c) 2009 - 2020