3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compare2D($topic, $nomination): int { if (is_array($nomination)) { return in_array($topic, $nomination) ? 1 : 0; } if (is_array($topic)) { return in_array($nomination, $topic) ? 1 : 0; } return strcmp($topic, $nomination) === 0 ? 1 : 0; } $topic = ['SECURE', 'REMOTE', 'test3']; $arr = [['REMOTE', 'REMOTE_PREMIUM'], 'SECURE', ['test1', ['test2', 'test3']]]; $res = array_uintersect($topic, $arr, 'compare2D'); var_dump($res);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> string(6) "SECURE" [1]=> string(6) "REMOTE" [2]=> string(5) "test3" }

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:
42.28 ms | 1407 KiB | 4 Q