3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "\tA\t B \tC \t D "; var_export( [ 'input' => $string, 'space, no flag' => preg_split('~ +~', $string), 'space, flag' => preg_split('~ +~', $string, -1, PREG_SPLIT_NO_EMPTY), 'tab, no flag' => preg_split('~\t+~', $string), 'tab, flag' => preg_split('~\t+~', $string, -1, PREG_SPLIT_NO_EMPTY), 'whitespace, no flag' => preg_split('~\s+~', $string), 'whitespace, flag' => preg_split('~\s+~', $string, -1, PREG_SPLIT_NO_EMPTY), 'tab&space, no flag' => preg_split('~[\t ]+~', $string), 'tab&space, flag' => preg_split('~[\t ]+~', $string, -1, PREG_SPLIT_NO_EMPTY), 'horizontal whitespace, no flag' => preg_split('~\h+~', $string), 'horizontal whitespace, flag' => preg_split('~\h+~', $string, -1, PREG_SPLIT_NO_EMPTY), ] );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'input' => ' A B C D ', 'space, no flag' => array ( 0 => ' A ', 1 => 'B', 2 => ' C', 3 => ' ', 4 => 'D', 5 => '', ), 'space, flag' => array ( 0 => ' A ', 1 => 'B', 2 => ' C', 3 => ' ', 4 => 'D', ), 'tab, no flag' => array ( 0 => '', 1 => 'A', 2 => ' B ', 3 => 'C ', 4 => ' D ', ), 'tab, flag' => array ( 0 => 'A', 1 => ' B ', 2 => 'C ', 3 => ' D ', ), 'whitespace, no flag' => array ( 0 => '', 1 => 'A', 2 => 'B', 3 => 'C', 4 => 'D', 5 => '', ), 'whitespace, flag' => array ( 0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', ), 'tab&space, no flag' => array ( 0 => '', 1 => 'A', 2 => 'B', 3 => 'C', 4 => 'D', 5 => '', ), 'tab&space, flag' => array ( 0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', ), 'horizontal whitespace, no flag' => array ( 0 => '', 1 => 'A', 2 => 'B', 3 => 'C', 4 => 'D', 5 => '', ), 'horizontal whitespace, flag' => array ( 0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', ), )

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:
25.73 ms | 409 KiB | 5 Q