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); }

preferences:
42.31 ms | 402 KiB | 5 Q