Re: multi-dimensional arrays and/or strings vs. numbers
| From: | Philip Olson | Date: | Thu, 27 Sep 2001 23:49:02 +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-69075@lists.php.net to get a copy of this message | ||
hi bill,
here's an example :
$arr = array(array('a'));
print "FOO: $arr[0][0]"; // FOO: Array[0]
print "BAR: {$arr[0][0]}"; // BAR: a
regards,
Philip Olson
On Thu, 27 Sep 2001, 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)?
>
> --
> Bill Rausch, Software Development, Unix, Mac, Windows
> Numerical Applications, Inc. 509-943-0861 bill@numerical.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>