嗨,我真的很难在这个旧的php函数中转换split函数,并且想知道是否有人可以帮助我?谢谢!
function prepare() {
/* Wildcard Rules
* SCALAR (?) => 'original string quoted'
* MISC (~) => original string (left 'as-is')
*/
$this->preparedquery = '';
$data = func_get_args();
$query = $data[ 0 ];
// How do I convert this split to preg_split?
$tokens = split( "[\?\~]", $query );
$this->preparedquery = $tokens[ 0 ];
$count = strlen( $tokens[ 0 ] );
for ( $i = 1; $i < count( $tokens ); $i++ ) {
$char = substr( $query, $count, 1 );
$count += ( strlen( $tokens[ $i ] ) + 1 );
$pdata = & $data[ $i ];
$this->preparedquery .= ( $char != "~" ? quote_smart_html( $pdata ) : $pdata );
$this->preparedquery .= $tokens[ $i ];
}
if ( $this->debug == '1' ) {
echo $this->preparedquery;
echo '<br>';
}
}