Question: For example, I want a function that returns me true for the following two inputs:

```
array('4','5','2') 
array('4','5','2')

```

Answer: 
You have a couple of options depending on what you want:

just use a straight `if`

```
 if($array === $array2)

```

or you can use [array\_diff](http://php.net/manual/en/function.array-diff.php) which will give you an output array of any differences.

```
 $diff = array_diff($array, $array2)

```
Yes, You can check that both arrays are the same or not using the array\_diff function.

```
$a1=array("4","5","2");
$a2=array("4","5","2");

$result=array_diff($a1,$a2);
print_r($result);

```

If Both arrays are not the same than it will return difference else return a blank array.