Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get index of element in array 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: #index #element #array #php
ADD COMMENT
Topic
Name
9+1 =