|
|
|
PHPใช้ฟังก์ชั่นไหนในการเช็คค่าของของ ข้อมูลใน array |
|
|
|
|
|
|
|
Basic Code (PHP)
$arrayName = array('A' =>'1' ,'B'=>' ','C'=>'3' );
$key = array_keys($arrayName);
$all_key = count($key);
for($i=0;$i<$all_key;$i++){
if($arrayName[$key[$i]]==''){
echo $key[$i].' = ว่าง<br />';
}else{
echo $key[$i].' = '.$arrayName[$key[$i]].'<br />';
}
}
|
|
|
|
|
Date :
2014-01-15 16:09:14 |
By :
mangkunzo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
}
if (in_array("mac", $os)) {
echo "Got mac";
}
?>
|
|
|
|
|
Date :
2014-01-15 23:19:08 |
By :
mariddew |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|