Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 713a3fc58c
Fetching contributors…

Cannot retrieve contributors at this time

file 96 lines (73 sloc) 1.151 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
--TEST--
Evaluation order during assignments.
--FILE--
<?php
$b = "bb";
$a = "aa";

function foo()
{
echo "Bad call\n";
}

function baa()
{
echo "Good call\n";
}

$bb = "baa";

$aa = "foo";

$c = ${$a=$b};

$c();

$a1 = array("dead","dead","dead");
$a2 = array("dead","dead","live");
$a3 = array("dead","dead","dead");

$a = array($a1,$a2,$a3);

function live()
{
echo "Good call\n";
}

function dead()
{
echo "Bad call\n";
}

$i = 0;

$a[$i=1][++$i]();

$a = -1;

function foo1()
{
  global $a;
  return ++$a;
}

$arr = array(array(0,0),0);

$brr = array(0,0,array(0,0,0,5),0);
$crr = array(0,0,0,0,array(0,0,0,0,0,10),0,0);

$arr[foo1()][foo1()] = $brr[foo1()][foo1()] +
                     $crr[foo1()][foo1()];

$val = $arr[0][1];
echo "Expect 15 and get...$val\n";

$x = array(array(0),0);
function mod($b)
{
global $x;
$x = $b;
return 0;
}

$x1 = array(array(1),1);
$x2 = array(array(2),2);
$x3 = array(array(3),3);
$bx = array(10);

$x[mod($x1)][mod($x2)] = $bx[mod($x3)];

// expecting 10,3

var_dump($x);
?>
--EXPECT--
Good call
Good call
Expect 15 and get...15
array(2) {
[0]=>
array(1) {
[0]=>
int(10)
}
[1]=>
int(3)
}
Something went wrong with that request. Please try again.