<?php // Use preg_split() function $string = "123,456,78,000"; $str_arr = preg_split ("/\,/", $string); print_r($str_arr); // use of explode $string = "123,46,78,000"; $str_arr = explode (",", $string); print_r($str_arr); ?> Output: Array ( [0] => 123 [1] => 456 [2] => 78 [3] => 000 ) Array ( [0] => 123 [1] => 46 [2] => 78 [3] => 000 )
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter