Created
June 6, 2017 01:45
-
-
Save falmesino/f9b8734a8617c35a0b84734dfb696136 to your computer and use it in GitHub Desktop.
Menampilkan tanda centang untuk data yang aktif dan silang untuk yang tidak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* tampilan_status.php | |
* Created by Falmesino Abdul Hamid (http://github.com/falmesino) | |
*/ | |
// Sampel data | |
$datas = array( | |
array( | |
'id' => 1, | |
'nama' => 'Tommy Mulia Octaviano', | |
'jk' => 'L', | |
'status'=> 0 | |
), | |
array( | |
'id' => 2, | |
'nama' => 'Muhammad Fikri A.', | |
'jk' => 'L', | |
'status'=> 1 | |
), | |
array( | |
'id' => 3, | |
'nama' => 'Yonglek', | |
'jk' => 'L', | |
'status'=> 1 | |
) | |
); | |
// Looping data sampel diatas | |
foreach($datas as $data) | |
{ | |
// Cetak id dan nama | |
echo $data['id'] . " " . $data['nama'] . " "; | |
// Cetak status | |
if($data['status'] == 0) | |
{ | |
// Jika statusnya nol, maka tampilkan tanda centang | |
echo " √"; | |
} | |
else | |
{ | |
// Jika statusnya bukan nol, maka tampilkan tanda silang | |
echo " ×"; | |
} | |
// Cetak baris baru | |
echo "<br/>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment