array_search in php
<?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;
?>
// 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
$a = [
'Canceled' => 1,
'Traded / Filled'=> 2,
'(Not used currently)'=> 3,
'Transit'=> 4,
'Rejected'=> 5,
'Pending'=> 6,
];
echo array_search("5",$a);
?>
$userdb = array(
array(
'uid' => '100',
'name' => 'Sandra Shush',
'pic_square' => 'urlof100'
),
array(
'uid' => '5465',
'name' => 'Stefanie Mcmohn',
'pic_square' => 'urlof100'
),
array(
'uid' => '40489',
'name' => 'Michael',
'pic_square' => 'urlof40489'
)
);
Also in PHP:
- You are *required* to use the date.timezone setting or t
- Laravel Eloquent, group by month/year
- alias seeddb='php artisan db:seed'
- date() today php
- composer install in laravel project
- buddy group hide notice join
- date format in day name of month and year in php
- cakephp extract array
- b64decode php
- add +1 day in given date in php
- SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
- artisan route:list
- create new projec in laravel
- date format php l with capital
- buat table seeder laravel
- display error reporting php
- centos 7 install php composer
- console.php
- case upper php
- divided by 3 php
- doctrine where
- < Php echo date("m") . " "; ?> what is the output of this script?
- codeigniter get insert iditer print last query
- check_string_lenght in php