[ create a new paste ] login | about

Link: http://codepad.org/80zPyHqD    [ raw code | output | fork ]

PHP, pasted on Nov 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$entries = array("example text 1", "example text 2", "example text 3", "example text 4", "example text 5");

$array = array("example text 1", "example text 2", "example text 3", "example text 7", "example text 8");

foreach($array as $key => $value) {
    foreach($entries as $entry) {
        if($entry == $value) echo "in array 1\n";
    }
    if (in_array($value, $entries)) {
        echo "in array 2\n";
    }
    if(isset($entries[$value])) {
        echo 'in array 3';
    }
}


Output:
1
2
3
4
5
6
in array 1
in array 2
in array 1
in array 2
in array 1
in array 2


Create a new paste based on this one


Comments: