how can I use isset values?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joelitos
Forum Newbie
Posts: 10
Joined: Sun May 17, 2009 12:43 am

how can I use isset values?

Post by joelitos »

Can you guys explain me what does this mean?

Code: Select all

 
$cat = isset($_GET['subject']) &&
is_numeric($_GET['subject'])?$_GET['subject']:null;
$prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null;
$menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null
 
And how can I use this values, give me as much opinios as you can.

I want to know how can I use a value when is isset($_GET, is_numeric($_GET, $_GET and null.

one example would be

Code: Select all

$class = !is_null($cat) && $cat==$row['id']?' class="selected"':''
Thank you..
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: how can I use isset values?

Post by Benjamin »

Code: Select all

$cat = isset($_GET['subject']) &&
is_numeric($_GET['subject'])?$_GET['subject']:null;
 
Is the same as:

Code: Select all

 
if (isset($_GET['subject'])) {
    $cat = $_GET['subject'];
} else {
    $cat = null;
}
 
joelitos
Forum Newbie
Posts: 10
Joined: Sun May 17, 2009 12:43 am

Re: how can I use isset values?

Post by joelitos »

Thank you astions
Post Reply