How to pass an array into a function, and return the results with an array

后端 未结 9 1420
你的背包
你的背包 2021-02-05 07:25

So I\'m trying to learn how to pass arrays through a function, so that I can get around PHP\'s inability to return multiple values. Haven\'t been able to get anything to work so

9条回答
  •  星月不相逢
    2021-02-05 07:58

    Another way is:

    $NAME = "John";
    $EMAIL = "John@gmail.com";
    $USERNAME = "John123";
    $PASSWORD = "1234";
    $array = Array ("$NAME","$EMAIL","$USERNAME","$PASSWORD");
    function getAndReturn (Array $array){
        return $array;
    }
    print_r(getAndReturn($array));
    

提交回复
热议问题