Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get array key based on value php

$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

$key = array_search('green', $array); // $key = 2;
$key = array_search('red', $array);   // $key = 1;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #array #key #based #php
ADD COMMENT
Topic
Name
5+5 =