3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = array('customer-test1' => 1, 'customer-test2' => 2); function getPost($param) { global $test; echo addslashes($param)." = ".$test[$param]."<br/>"; return isset($test[$param]) ? $test[$param] : NULL; } class Customer { private $test1; private $test2; function __construct() { } } $object = new Customer(); $arr = (array)$object; $newArr = array(); foreach($arr as $key => $val) { $newKey = str_replace(get_class($object), "", $key); $newArr[$newKey] = getPost(strtolower(get_class($object))."-".$newKey); }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "customer-" in /in/vgfI1 on line 5 customer-\0\0test1 = <br/> Warning: Undefined array key "customer-" in /in/vgfI1 on line 5 customer-\0\0test2 = <br/>

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:
32.37 ms | 401 KiB | 8 Q