How to access the elements of a function's return array?

后端 未结 15 2203
栀梦
栀梦 2020-12-05 03:46

I need to return multiple values from a function, therefore I have added them to an array and returned the array.



        
15条回答
  •  一整个雨季
    2020-12-05 04:26

    function give_array(){
    
        $a = "abc";
        $b = "def";
        $c = "ghi";
    
        return compact('a','b','c');
    }
    
    
    $my_array = give_array();
    

    http://php.net/manual/en/function.compact.php

提交回复
热议问题