0

これを試して:

$pattern = '/[\x{ff0c},]/u';

//$string = "something here ; and there, oh,that's all!";
$string = 'hei,nihao,a ';


echo '<pre>', print_r( preg_split( $pattern, $string ), 1 ), '</pre>';
exit();

出力:

<pre>Array
(
    [0] => hei,nihao,a
)
</pre>
4

1 に答える 1

0

あなたが持っている文字は、全角コンマ(hex ff0c)と通常のコンマです。それを説明する私のバージョンに更新してみましたか?

<?php
$pattern = '/[\x{ff0c},]/u';

//$string = "something here ; and there, oh,that's all!";
$string = 'hei,nihao,a ';


echo '<pre>', print_r( preg_split( $pattern, $string ), 1 ), '</pre>';

出力:

Array
(
    [0] => hei
    [1] => nihao
    [2] => a 
)
于 2009-09-21T04:06:25.977 に答える