3v4l.org

run code in 300+ PHP versions simultaneously
<?php function validate_length($min = 1, $max = null) { return static function ($value = null) use ($min, $max) { $len = strlen($value); if (null !== $min && $len < $min) { return false; } if (null !== $max && $len > $max) { return false; } return $value; }; } $a = [ 'a' => 'value', 'b' => '', 'c' => 'Valid' ]; $result = filter_var_array ($a, [ 'a' => ['filter' => FILTER_CALLBACK, 'options' => validate_length(null, 4)], 'b' => ['filter' => FILTER_CALLBACK, 'options' => validate_length(1)], 'c' => ['filter' => FILTER_CALLBACK, 'options' => validate_length(1, 10)] ]); var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { ["a"]=> bool(false) ["b"]=> bool(false) ["c"]=> string(5) "Valid" }

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:
26.41 ms | 405 KiB | 5 Q