3v4l.org

run code in 300+ PHP versions simultaneously
<?php function makeKeyboard($str) { $kb = array(); $kb_row = explode('|', $str); foreach($kb_row as $row) { $buttons = explode(',', $row); $newrow = array(); foreach($buttons as $text) { $newrow[] = array('text' => $text); } $kb[] = $newrow; } return $kb; } $test = "button1.1|button2.1,button2.2,button2.3|button3.1|button4.1,button4.2"; $keyboard = makeKeyboard($test); print_r($keyboard); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => Array ( [text] => button1.1 ) ) [1] => Array ( [0] => Array ( [text] => button2.1 ) [1] => Array ( [text] => button2.2 ) [2] => Array ( [text] => button2.3 ) ) [2] => Array ( [0] => Array ( [text] => button3.1 ) ) [3] => Array ( [0] => Array ( [text] => button4.1 ) [1] => Array ( [text] => button4.2 ) ) )

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:
36.19 ms | 408 KiB | 5 Q