Danzoe’s Webloz
Just another Danzoe webloz !

Check Variable Kosong ?

Kalau mau cek apakah variable itu kosong atau nggak, bisa pake ini. “ empty($var)

Example :

<?php
$var 
0;

// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
‘Variabel $var adalah 0, empty, atau tidak ada !’;
}

// Evaluates as true because $var is set
if (isset($var)) {
    echo 
‘Variabel $var kosong’;
}
?>

No Responses ke “Check Variable Kosong ?”

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.