Hello,
"empty" <[EMAIL PROTECTED]> wrote:
> Hi
> <?php
> $stra=("aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll");
> $splited = array();
> $splited = split(",",$stra);
> $c=count($splited);
> for($i=0 ; $i<$c ; $i+=2){
> echo "$splited[$i]";
> echo "$splited[$i+1]"; // *****error is here******** >
> //Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting ']' in D:\sites\c\htemp.php on line 12
> echo "<br>"
> }
> ?>
>
> I want to see on the screen is that
> aabb
> ccdd
> eeff
> gghh
> iijj
> kkll
>
> but the code above says wrong :(
Try incrementing $i outside:
for($i=0 ; $i<$c ; $i++){
echo "$splited[$i]";
$i++;
echo "$splited[$i]";
echo "<br>";
}
HTH,
- E
PS
BTW, notice the $i++ on the top as well.
And also, the semi-colon after "<br>"--you'll get a "parse error" again :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php