note 67982 deleted from function.explode by bjori

From: Date: Mon, 25 Sep 2006 08:06:03 +0000
Subject: note 67982 deleted from function.explode by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117567@lists.php.net to get a copy of this message
Note Submitter: bxm AT cs d0t nott d0t ac d0t uk ---- The markus function will echo "Found more than 2 encapsulations - this should not happen!", when invoked with a string containing escaped $encap characters. For example: $delim = ","; $string = "'first,data','second,data','it\\'s the last data'"; $encap = "'"; quote_explode( $delim, $string, $encap ); The following small modification to the markus function seems to prevent escaped $encap characters from being considered as the terminating $encap character. Replace the line: $numEncaps = substr_count( $part, $encap ); With the line: $numEncaps = substr_count( $part, $encap ) - substr_count( $part, '\\\\'.$encap );

« previous php.notes (#117567) next »