Jump to content

the ? and : thing...


alexruimy

Recommended Posts

I have code that looks like this:
[hr]
[code=php:0]$result  =  move_uploaded_file($temp_name, $file_path);
  if (!chmod($file_path,0777))
    $message = "change permission to 777 failed.";
  else
    $message = ($result)?"$file_name uploaded successfully." :
              "Something is wrong with uploading a file.";[/code]
[hr]
Just wondering what the ($result)? part is.  My guess is that it's equivalent to the following:
[hr]
[code=php:0]if ($result){
$message = "$file_name uploaded successfully.";
}
else {$message = "Something is wrong with uploading a file."};[/code]
[hr]

Am I on the right track? Can someone elaborate for me as to what this is?
Link to comment
https://forums.phpfreaks.com/topic/17032-the-and-thing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.