This article mainly introduces the functions that can return multiple values in php. The example analyzes php's tips for returning multiple values using arrays. For more information, see
This article mainly introduces the functions that can return multiple values in php. The example analyzes php's tips for returning multiple values using arrays. For more information, see
This example describes how to implement a function that can return multiple values in php. Share it with you for your reference. The specific analysis is as follows:
In python and golang, there is a function that returns multiple values at the same time. In fact, php can also be used, but it is a little more troublesome than python and golang. Below is a simple demo, the list function is used here.
<? Php function retrieve_user_profile () {$ user [] = "Jason"; $ user [] = "jb51.net"; $ user [] = "English"; return $ user ;} list ($ name, $ email, $ language) = retrieve_user_profile (); echo "Name: $ name, email: $ email, preferred language: $ language";?>
I hope this article will help you with php programming.
,