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); } } */ $table = array('id', 'name', 'age', 'updated_at', 'created_at'); $attrAccessible = array('name', 'age', 'location'); $attributes = array('id' => 0, 'name' => 'Jacopo', 'age' => 25, 'location' => 'Milan', 'updated_at' => null, 'created_at' => null); $checkArrayTable = array_fill_keys($table, 0); $checkArray = array_fill_keys($attrAccessible, 0); $purgedArray = array_diff_key($attributes, $checkArray); $purgedArray = array_intersect_key($attributes, $checkArrayTable); print_r($purgedArray);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [id] => 0 [name] => Jacopo [age] => 25 [updated_at] => [created_at] => )

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.94 ms | 401 KiB | 8 Q