3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $obj = new stdClass(); $obj->a = 65; $stack = array("orange", "banana"); $stack2 = array(array("11", "22",array("77", "99")), "orange2", "banana2", array("33", "44"), new DateTime,$obj); var_dump($stack2); $a='gggg'; array_push($stack, $stack2, 'ff','tt','ii',$stack); print_r($stack); print_r($stack2); /*$stack = array("orange", "banana"); $stack2 = array("orange2", "banana2"); $stack2 = array(array("11", "22"), "orange2", "banana2", array("33", "44")); $result = array_merge($stack,'ff','tt','ii', $stack2); print_r($result);*/
based on r1h8R

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
array(6) { [0]=> array(3) { [0]=> string(2) "11" [1]=> string(2) "22" [2]=> array(2) { [0]=> string(2) "77" [1]=> string(2) "99" } } [1]=> string(7) "orange2" [2]=> string(7) "banana2" [3]=> array(2) { [0]=> string(2) "33" [1]=> string(2) "44" } [4]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-20 20:54:45.000119" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [5]=> object(stdClass)#1 (1) { ["a"]=> int(65) } } Array ( [0] => orange [1] => banana [2] => Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000119 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) ) [3] => ff [4] => tt [5] => ii [6] => Array ( [0] => orange [1] => banana ) ) Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000119 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) )
Output for Arrow functions
array(6) { [0]=> array(3) { [0]=> string(2) "11" [1]=> string(2) "22" [2]=> array(2) { [0]=> string(2) "77" [1]=> string(2) "99" } } [1]=> string(7) "orange2" [2]=> string(7) "banana2" [3]=> array(2) { [0]=> string(2) "33" [1]=> string(2) "44" } [4]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-20 20:54:45.000105" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [5]=> object(stdClass)#1 (1) { ["a"]=> int(65) } } Array ( [0] => orange [1] => banana [2] => Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000105 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) ) [3] => ff [4] => tt [5] => ii [6] => Array ( [0] => orange [1] => banana ) ) Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000105 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) )
Output for Object typehint
array(6) { [0]=> array(3) { [0]=> string(2) "11" [1]=> string(2) "22" [2]=> array(2) { [0]=> string(2) "77" [1]=> string(2) "99" } } [1]=> string(7) "orange2" [2]=> string(7) "banana2" [3]=> array(2) { [0]=> string(2) "33" [1]=> string(2) "44" } [4]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-20 20:54:45.000119" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [5]=> object(stdClass)#1 (1) { ["a"]=> int(65) } } Array ( [0] => orange [1] => banana [2] => Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000119 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) ) [3] => ff [4] => tt [5] => ii [6] => Array ( [0] => orange [1] => banana ) ) Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000119 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) )
Output for Array change keys
array(6) { [0]=> array(3) { [0]=> string(2) "11" [1]=> string(2) "22" [2]=> array(2) { [0]=> string(2) "77" [1]=> string(2) "99" } } [1]=> string(7) "orange2" [2]=> string(7) "banana2" [3]=> array(2) { [0]=> string(2) "33" [1]=> string(2) "44" } [4]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-20 20:54:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [5]=> object(stdClass)#1 (1) { ["a"]=> int(65) } } Array ( [0] => orange [1] => banana [2] => Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) ) [3] => ff [4] => tt [5] => ii [6] => Array ( [0] => orange [1] => banana ) ) Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) )
Output for Lexical anon
array(6) { [0]=> array(3) { [0]=> string(2) "11" [1]=> string(2) "22" [2]=> array(2) { [0]=> string(2) "77" [1]=> string(2) "99" } } [1]=> string(7) "orange2" [2]=> string(7) "banana2" [3]=> array(2) { [0]=> string(2) "33" [1]=> string(2) "44" } [4]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-20 20:54:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [5]=> object(stdClass)#1 (1) { ["a"]=> int(65) } } Array ( [0] => orange [1] => banana [2] => Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) ) [3] => ff [4] => tt [5] => ii [6] => Array ( [0] => orange [1] => banana ) ) Array ( [0] => Array ( [0] => 11 [1] => 22 [2] => Array ( [0] => 77 [1] => 99 ) ) [1] => orange2 [2] => banana2 [3] => Array ( [0] => 33 [1] => 44 ) [4] => DateTime Object ( [date] => 2016-01-20 20:54:45.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) [5] => stdClass Object ( [a] => 65 ) )

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