note 119797 deleted from function.return by peehaa

From: Date: Sun, 28 Apr 2019 10:27:24 +0000
Subject: note 119797 deleted from function.return by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210784@lists.php.net to get a copy of this message
Note Submitter: hairbysubaru at gmail dot com ---- <?php $stat = array("Inactive","Active"); function fred($z) { $a = "firstname"; $b = "lastname"; $status=0; return array($a,$b,$z,$status); } $results = list($ra,$rb,$rc,$status) = fred("user_details"); //what we get... print_r($results); // interpreted results, knowing the 'structure' of $results. echo "context value 2(heading):".$results[2]; echo "context value 0(user fname):".$results[0]; echo "context value 1(user lname):".$results[1]; echo "context value 3(status):".$results[3]; echo "status:".$stat[$results[3]]; ?> Produces... Array ( [0] => firstname [1] => lastname [2] => user_details [3] => 0 ) context value 0(heading):user_details context value 1(user fname):firstname context value 2(user lname):lastname context value 3(status):0 status:Inactive Context is everything.

« previous php.notes (#210784) next »