Jump to content

[SOLVED] Simplifying an IF statement


acctman

Recommended Posts

I'd like to know if this coding is correct, I ran it through a PHP IDE app and no errors were shown. i just want to double check, the second one line code

 

if ($_POST['add_type'] == 1) {
$points == 2;
} else {
$points == 1;
}

 

compact way, is this right?

$points = ($_POST['add_type']==1) ? 2 : 1;

Link to comment
https://forums.phpfreaks.com/topic/123174-solved-simplifying-an-if-statement/
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.