3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("hello", "world", "foobar"); $value1 = "foobar"; $value2 = "test"; if(!in_array($value1, $array)) $array[] = $value1; // this will not be added because foobar already exists in the array if(!in_array($value2, $array)) $array[] = $value2; // this will be added because it does not exist in the array print_r($array); ?>

preferences:
43.8 ms | 402 KiB | 5 Q