Is it possible to parse strings in an array based on multiple delimiters? as described in the code:
$str ="a,bc,d;ef"; //What i want is to convert this string into array //using the delimiters space, comma, semicolon
$str = "a,bc,d;ef"; $pieces = preg_split('/[, ;]/', $str); var_dump($pieces);
CodePad
array(6) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "d" [4]=> string(1) "e" [5]=> string(1) "f" }
strtok → http://php.net/manual/en/function.strtok.php
Source: https://habr.com/ru/post/1345038/More articles:WordPress WP_Query - Parent Query Pages Only - wordpressNew action in index view - ruby | fooobar.comAdding scrollbars to HTML - javascriptStrange error viewing user rights - ruby | fooobar.comProposed data structure for ranking users based on ratings - algorithmLabel label semantics - htmlHow to call a method in a jar file from Visual C ++? - jarMonitoring progress in Parallel.ForEach - multithreadingFind out if method is protected or protected - protectedEPS opacity - opacityAll Articles