array_search
// array demo
public $gender = array(
1 => 'Male',
2 => 'Female',
3 => 'Other',
);
$gen = 1;
if ($gen == array_search('Male', $this->gender)) {
$gender = __d('member', 'male');
} elseif ($gen == array_search('Female', $this->gender)) {
$gender = __d('member', 'female');
}
<?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;
?>
Also in PHP:
- console.php
- advantages of php
- associative array in one key in value must unique in array check in php
- clear array php
- convert caps to sentese case php
- display the date and time in php
- Your Composer dependencies require the following PHP extensions to be installed: dom, mbstring, xml, xmlwriter
- check if substring php
- add one day to given date in php
- check session in blade laravel
- base decode 64 php
- array to string separated by comma php
- access config variable in codeigniter controller
- Redirection page php
- check if substring is present php
- create seede for table in laravel
- encryption key has not encrypted laravel
- euclid algorithm
- Str::random
- angular post phph
- display errors off php
- display error warning php
- composer global in laravel means
- Created Migration: laravel