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"

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

Reply via email to