Re: Odd array problems
| From: | Brad LaFountain | Date: | Sat, 03 Aug 2002 00:42:18 +0000 |
| Subject: | Re: Odd array problems | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-86469@lists.php.net to get a copy of this message | ||
Should be fixed..... I swear there better not be anything else wrong with that
code chage :) I know alot more how the engine handles arrays now :)
- brad
--- Dan Kalowsky <dank@deadmime.org> wrote:
> Correction an update from a few mins ago results in the same output as
> Chuck's original.
>
> 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."
> dank-nos@mpa-deadmime.org - "A Little Less Conversation",
> kalowsky@php.net Elvis Presley
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com