Re: Array Assignment
| From: | Alexander Skwar | Date: | Sat, 05 May 2001 13:40:51 +0000 |
| Subject: | Re: Array Assignment | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51536@lists.php.net to get a copy of this message | ||
So sprach Christian Reiniger am Fri, May 04, 2001 at 08:24:21PM +0200:
> On Saturday 05 May 2001 16:55, Mark Cain wrote:
>
> > $first = "Elementary";
> > $second = "Middle";
>
> > $first[$second] = "pass";
>
> > echo "After Assignment:<BR>";
> > echo "first = $first<BR>"; // prints: first = plementary --- what
> > is this ????!!
>
> $first is a string, i.e. $first [$n] accesses the $n'th character in the
> string "Elementary".
Well, I think the issue is, that Mark first assigned something to $first,
which then made this a string variable. Later on he assigned something to
$first[$second]. This broke because of the reasons Christian mentioned.
Mark, if you directly assign $first[$second] the value "pass", then it
should work.
Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage: http://www.digitalprojects.com | http://www.iso-top.de
iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 21 hours 11 minutes