We have 14 guests online
   
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

Returning multiple values from a function
User Rating: / 0
PoorBest 

Demonstrates how to return multiple values from a function using arrays and list().

  1. <?php
  2.    function retrieve_user_profile() {
  3.       $user[] = "Jason";
  4.       $user[] = " This e-mail address is being protected from spam bots, you need JavaScript enabled to view it ";
  5.       $user[] = "English";
  6.       return $user;
  7.    }
  8.    list($name,$email,$language) = retrieve_user_profile();
  9.    echo "Name: $name, email: $email, preferred language: $language";
  10.  
  11.    // courtesy apress.com
  12. ?>

 

 

Directory Stats

There are 708 listing and 43 categories in our website

Change Language

Loans
0% Balance Transfers
Unsecured Loans
Credit Cards
Online Loans