Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

What is the meaning of this one line code in php?

Posted on 2016-11-28
3
Medium Priority
?
67 Views
Last Modified: 2016-11-29
Hello;

I am trying to reconstruct a website,now i see this code below regarding the isset() function in php ,please let me know its meaning,i have read the php.net manual for isset() function.

$code = (isset($_GET["artistfamilye"]) ? $_GET['artistfamilye'] : null );

Open in new window


Thanks
0
Comment
Question by:MOSTAGHASSI
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
Mukesh Yadav earned 1000 total points
ID: 41905241
In this code we are checking for query string "artistfamilye" if it exists then assigning value to a variable else assigning null to that variable and we are using ternary operator to assign different value based on isset function result.

isset function returns true is variable is defined and false if variable is not defined;
0
 
LVL 22

Assisted Solution

by:Kim Walker
Kim Walker earned 1000 total points
ID: 41905275
This statement is called a ternary conditional statement. It is equivalent to:
if (isset($_GET["artistfamilye"]) ) {
    $code = $_GET['artistfamilye'];
} else {
    $code = null;
}

Open in new window

1
 

Author Closing Comment

by:MOSTAGHASSI
ID: 41905298
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question