My output looks a lot different than yours and I'm not receiving the
notices you are.  Same script.... only on OSX debug from the CLI.

<pre />array(3) {
  [0]=>
  string(10) "
--<br />
"
  [1]=>
  string(6) "<br />"
  [2]=>
  string(11) "After delim"
}

End of script

CVS HEAD from earlier this morning (arond 9 am EST).

On Fri, 2 Aug 2002, Chuck Hagenbuch wrote:

> With latest CVS (HEAD branch, checked out 10 or so minutes ago), the
> following script:
>
> <?php
>
> error_reporting(E_ALL);
> $text = "Before delim.<br />\n--<br />\nAfter delim";
>
> $parts = preg_split('|(\n--\s*(<br />)?\n)|', $text, 2, PREG_SPLIT_DELIM_CAPTURE);
> $text = array_shift($parts);
> if (count($parts)) {
>     echo '<pre />'; var_dump($parts);
>     $text .= $parts[0];
>     $text .= $parts[2];
> }
>
> ?>
>
> Gives me this output:
>
> array(3) {
>   [0]=>
>   string(10) "
> --
> "
>   [1]=>
>   string(6) ""
>   [2]=>
>   string(11) "After delim"
> }
>
> Notice:  Undefined offset:  0 in /var/www/array.php on line 10
>
> Notice:  Undefined offset:  2 in /var/www/array.php on line 11
>
> ----
>
> But the var_dump() clearly shows that there _are_ elements 0 and 2 in
> the array. What am I missing, or is something still off with the array
> code?
>
> -chuck
>
> --
> "hello, I'm a giant cheese, and I'm here to give you a therapeutic massage"
>
>

>---------------------------------------------------------------<
Dan Kalowsky                    "A little less conversation,
http://www.deadmime.org/~dank    a little more action."
[EMAIL PROTECTED]        - "A Little Less Conversation",
[EMAIL PROTECTED]                        Elvis Presley


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to