Re: php: assignment operator

From: Date: Wed, 07 Aug 2002 14:26:44 +0000
Subject: Re: php: assignment operator
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-111499@lists.php.net to get a copy of this message
So, if there was not the assignment operator like this in the script below: .= ............... $image_tag_src.="<IMG SRC=\"$image_src\" BORDER=\"0\">" ............... but let's say a = the output would echo ONE placeholder for the IMG SRC from 0 through 9 - however when the 10th time the page was loaded it would still be in the *same* IMG SRC holder and there never be a second IMG SRC holder - to the right - (10 through 99), a third to the right of the second (100 through 999), etc. Please advise. Thank you for your time. TR ................................. for($i=0; $i<strlen($counter); $i++) { $image_src=$image_dir. "/" .substr($counter, $i, 1) . ".jpg"; $image_tag_src.="<IMG SRC=\"$image_src\" BORDER=\"0\">"; // assignment operator .= } ............................... Mike Ford <M.Ford@lmu.ac.uk> wrote in message news:7E070107F405BA4790C43526CC4985A10132ABBA@lis-exchange3.lmu.ac.uk... > > -----Original Message----- > > From: Anthony Ritter [mailto:tony@gonefishingguideservice.com] > > Sent: 07 August 2002 04:58 > > > > > > > That's the case if strlen($counter) is 1. If it were more, > > you'd see > > > multiple image tags in there. > > > > > > --Dan > > ................................ > > > > Thanks Dan. > > > > I tried an example with the number 3 replacing the number 1 > > ....................... > > > > $image_src=$image_dir. "/" .substr($counter, $i, 3) . ".jpg"; > > .......................... > > > > and the script works o.k. so I couldn't see the difference. > > That's not the length he's referring to. Consider the case where that > substr reverts to substr($counter, $i, 1), but $counter="123" (so > strlen($counter)==3). > > Cheers! > > Mike > > --------------------------------------------------------------------- > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Beckett Park, LEEDS, LS6 3QS, United Kingdom > Email: m.ford@lmu.ac.uk > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#111499) next »