Answers for "php get item in array"

PHP
18

php in array

$colors = array("red", "blue", "green"); 
 
if (in_array("red", $colors)) { 
	echo "found red in array"; 
}
Posted by: Guest on July-01-2019
15

php value in array

in_array ( mixed $needle , array $haystack , bool $strict = false ) : bool
Posted by: Guest on January-28-2021
0

how to lookup value inside object php

$array = [
    'clothes' => 't-shirt',
    'size'    => 'medium',
    'color'   => 'blue',
];
 
extract($array);
 
echo("$clothes $size $color"); // t-shirt medium blue
Posted by: Guest on October-30-2020

Browse Popular Code Answers by Language