1function getXYZ()
2{
3 return array(4,5,6);
4}
5
6list($x,$y,$z) = getXYZ();
7
8// Afterwards: $x == 4 && $y == 5 && $z == 6
9// (This will hold for all samples unless otherwise noted)
1<?php
2
3function data() {
4 $out[0] = "abc";
5 $out[1] = "def";
6 $out[2] = "ghi";
7 return $out;
8}
9
10$data = data();
11foreach($data as $items){
12 echo $items;
13}
14
1// Function to swap two numbers
2function swap( $x, $y ) {
3 return array( $y, $x );
4}