From a line committed in 2014 by a former contractor at my job:
if (isset($live) && !is_null($live) && !empty($live)) {Can't be too careful. #PHP #Overkill #Programminglike this
Hank G
•Hypolite Petovan
•?:??Of course there can be several years between introduction and adoption.
like this
Hank G and clacke: exhausted pixie dream boy πΈπͺππ°ππ like this.
Hank G
•Hypolite Petovan likes this.
clacke: exhausted pixie dream boy πΈπͺππ°ππ
•orlike||in some languages, but it's an Elvis when it's spelled?:?like this
Hypolite Petovan and Hank G like this.
Hank G
•clacke: exhausted pixie dream boy πΈπͺππ°ππ
•In JS ?? is or-if-nullish and || is or:
false || 23 == 23
false ?? 23 == false
null ?? 23 == 23
undefined ?? 23 == 23
Is Elvis an or-if-null or an or?
Hypolite Petovan
•Hank G likes this.
Christoph S
•Hank G
•Samuel Roland
•echo $live ?? 'no value'; //in case it would be null...
Hypolite Petovan
•!empty($live)in the condition, it covers bothisset($live)and!is_null($live)and both could be safely removed from the condition.clacke: exhausted pixie dream boy πΈπͺππ°ππ likes this.