dragon8899 2015-09-23 11:46
浏览 29

调用preg_split后保留键

I'm using preg_match for performing a regular expression match, but before using it I declared my array with specific keys as follows:

$record = array ( "title"         => '',
                  "review"        => '',
                  "publisher"     => '',
                );

and here I call the function

$record = preg_split( "/(\s\|\s)|(\s\|)/", $data, 4 );

If I try to use the array with

echo $record['title'];

I got the following message error:

PHP Notice:  Undefined index: title

Is there a way to preserve my keys?

  • 写回答

0条回答 默认 最新

    报告相同问题?