Re: multi-dimensional arrays and/or strings vs. numbers

From: Date: Sat, 29 Sep 2001 10:09:45 +0000
Subject: Re: multi-dimensional arrays and/or strings vs. numbers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69273@lists.php.net to get a copy of this message
Hi. It's probably due to teh php parser. In the first case, echo "v[0][0]=$v[0][0]<br>"; the parser understands it as echo "v[0][0]={$v[0]}[0]<br>";. $v[0] is a table (Array) ... that's why v[0][0]=Array[0]. In the second case, the parser treats it as echo "v[0][0]={$v[0][0]}<br>"; I hope i was clear; Bill Rausch wrote:
I'm totally confused about the following code: <?php $t=3.3; echo "t=$t<br>"; echo "t=".$t."<br>"; $u = array(0.1,1.1,2.1,3.1); echo "u[0]=$u[0]<br>"; echo "u[0]=".$u[0]."<br>"; $v = array( array(0.1,1.1,2.1,3.1),
        array(0.11,1.11,2.11,3.11),
        array(0.12,1.12,2.12,3.12),
        array(0.13,1.13,2.13,3.13) );
echo "v[0][0]=$v[0][0]<br>"; echo "v[0][0]=".$v[0][0]."<br>"; ?> which when executed produces: t=3.3 t=3.3 u[0]=0.1 u[0]=0.1 v[0][0]=Array[0] v[0][0]=0.1 Why is the echo of the multi-dimensional array item within the quotes different? Is it in the manual (I swear I've looked)?
-- TURPIN Jean Max STUDENT College of Reunion's Island

« previous php.general (#69273) next »