Home > Backend Development > PHP Tutorial > Implement a function instance that can return multiple values ​​in php, php example_PHP tutorial

Implement a function instance that can return multiple values ​​in php, php example_PHP tutorial

WBOY
Release: 2016-07-13 10:02:02
Original
868 people have browsed it

Instances of functions that can return multiple values ​​are implemented in php. Examples of php

The examples in this article describe the usage of functions that can be implemented in php that can return multiple values. Share it with everyone for your reference. The specific analysis is as follows:

In python and golang, there is a method for a function to return multiple values ​​at the same time. In fact, PHP can also do it, but it is a little more troublesome than python and golang. Here is a simple demonstration example, where the list function is used

<&#63;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";
&#63;>
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970977.htmlTechArticleA function instance that can return multiple values ​​​​in php, php example This article tells an example of a function that can return multiple values ​​​​in php Function usage for values. Share it with everyone for your reference. The specific analysis is as follows...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template