3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stuff = "[1379082600-1379082720],[1379082480-1379082480],[1379514420-1379515800],"; var_export(preg_split('/[\],[]+/', $stuff, 0, PREG_SPLIT_NO_EMPTY)); // 72 steps var_export(preg_split('/[^\d-]+/', $stuff, 0, PREG_SPLIT_NO_EMPTY)); // 72 steps var_export(preg_match_all('/[\d-]+/', $stuff, $matches) ? $matches[0] : 'failed'); // my pattern #1: 16 steps var_export(preg_match_all('/\[(.*?)\]/' ,$stuff, $matches) ? $matches[0] : 'failed'); // bora's pattern: 144 steps var_export(preg_match_all('/[^\],[]+/', $stuff, $matches) ? $matches[0] : 'failed'); // my pattern #2: 16 steps var_export(explode(",", str_replace(["[", "]"], "", $stuff))); // Andy Gee's method (flawed / incorrect -- 4 elements in output) var_export(explode('],[', trim($stuff, '[],'))); // Alex Howansky's is the cleanest, efficient / correct method // OP's method (flawed / incorrect -- 4 elements in output) $stuff = str_replace(["[","]"], ["", ""], $stuff); $stuff = explode(",",$stuff); var_export($stuff);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => '1379082600-1379082720', 1 => '1379082480-1379082480', 2 => '1379514420-1379515800', )array ( 0 => '1379082600-1379082720', 1 => '1379082480-1379082480', 2 => '1379514420-1379515800', )array ( 0 => '1379082600-1379082720', 1 => '1379082480-1379082480', 2 => '1379514420-1379515800', )array ( 0 => '[1379082600-1379082720]', 1 => '[1379082480-1379082480]', 2 => '[1379514420-1379515800]', )array ( 0 => '1379082600-1379082720', 1 => '1379082480-1379082480', 2 => '1379514420-1379515800', )array ( 0 => '1379082600-1379082720', 1 => '1379082480-1379082480', 2 => '1379514420-1379515800', 3 => '', )array ( 0 => '1379082600-1379082720', 1 => '1379082480-1379082480', 2 => '1379514420-1379515800', )array ( 0 => '1379082600-1379082720', 1 => '1379082480-1379082480', 2 => '1379514420-1379515800', 3 => '', )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
136.21 ms | 407 KiB | 5 Q