- print_r: documentation ( source)
- in_array: documentation ( source)
<?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);
?>