Answers for "in php if array contain string and number if we return the array the number are come first in array why"

PHP
41

check if array has value php

$myArr = [38, 18, 10, 7, "15"];

echo in_array(10, $myArr); // TRUE
echo in_array(19, $myArr); // TRUE

// Without strict check
echo in_array("18", $myArr); // TRUE
// With strict check
echo in_array("18", $myArr, true); // FALSE
Posted by: Guest on January-21-2020
0

check if all values in array are equal php

if(count(array_unique($array)) === 1) {
    // all values in $array are the same
} else {
    // at least 1 value in $array is different
}
Posted by: Guest on July-08-2020

Code answers related to "in php if array contain string and number if we return the array the number are come first in array why"

Browse Popular Code Answers by Language