// make two different arrays with same value in PHP
$arr1 = [1, 2, 3];
$arr2 = [1, 2, 3];
if ($arr1 === $arr2) {
     echo "true";
     } else {
     echo "false";
     }
// the output will be true
// make arrays in JS
const arr3 = [1, 2, 3];
const arr4 = [1, 2, 3];
if (arr3 === arr4) {
console.log(true);
} else {
console.log(false);
}
// it outputs false
/* because unlike PHP in JS type of arrays is object therefore instead of comparing the values or number of elements , it checks the reference of those array which is different that's why it returned false */ P.S If we use == in JS (only comparing value, not type), however it returns false
by Luka Khitaridze
2 years ago
PHP
JavaScript
Array
0
Pro tip: use ```triple backticks around text``` to write in code fences