"something here ; and there, oh,that's all!"
I want to split it by ;
and ,
so after processing should get:
something here and there oh that's all!
Advertisement
Answer
<?php $pattern = '/[;,]/'; $string = "something here ; and there, oh,that's all!"; echo '<pre>', print_r( preg_split( $pattern, $string ), 1 ), '</pre>';