3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* if (isset(static::$attrAccessible)) { if (is_array(static::$attrAccessible) && count(static::$attrAccessible) > 0) { $checkArray = array_fill_keys(static::$attrAccessible, 0); $attributes = array_intersect_key($attributes, $checkArray); } } elseif (isset(static::$attrProtected)) { if (is_array(static::$attrProtected) && count(static::$attrProtected) > 0) { $checkArray = array_fill_keys(static::$attrProtected, 0); $attributes = array_diff_key($attributes, $checkArray); } } */ $attrAccessible = array('name', 'age', 'location'); $attributes = array('id' => 0, 'name' => 'Jacopo', 'age' => 25, 'location' => 'Milan', 'updated_at' => null, 'created_at' => null); $checkArray = array_fill_keys($attrAccessible, 0); $purgedArray = array_intersect_key($attributes, $checkArray); print_r($purgedArray);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [name] => Jacopo [age] => 25 [location] => Milan )

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