----- Original Message -----
From: "empty" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 02, 2002 8:08 PM
Subject: [PHP] printing array


> 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******** >

You can do (at least) two things here to resolve that error:
1. If you really want the double quotes:
echo "{$splited[$i+1]}";  // curly braces help resolve the arrary reference
in double quoted strings.
2. Drop the double quotes:
echo $splited[$i+1];

> //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 :(
>
> Can you help me?
> Thanks everybody.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to