First, the ()'s in the split regex makes no sense. Split has no registers
to save stuff to.
Second, that is a rather clunky way to loop through an array.
Third, since the regex in split defines the delimiter to use to split the
string on, the actual "1 -->" part of the data is gone. Why are you
checking for it via an ereg() call in the loop?
As far as I can tell, you simply want this:
$buffer = split("[0-9] -->",$pagedata);
foreach($buffer as $val) echo "$val<br>\n";
But then again, I don't really know what you are trying to do here.
-Rasmus
On Mon, 15 Jan 2001, Romulo Roberto Pereira wrote:
> Hey people!
>
> What is wrong with this code?
>
> $buffer = split("([0-9] -->)",$pagedata);
> $x = count ($buffer);
> echo $x;
> for ($i=0;$i<$x;$i++) {
> ereg("([0-9] -->)", $buffer[$i], $text);
> ereg_replace (" -->","", $text[1]);
> echo $text[1];
> }
>
> Since $pagedata has 8 appearences of the REGEX I am looking for and it is
> only printing the first one...
>
> Help! ;-)
>
> Thank you,
>
> Rom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]