vendredi 27 octobre 2017

Codition if ternary codition

I made this code in php 7.1 want to do a ternary condition and i got syntax error from this line in my code:

 ( (is_null($json['apellido_paterno']) || trim($json['apellido_paterno']==='')) ? $json['apellido_materno'] : $json['apellido_paterno']));


LasName SecondName  Result
Herrera Gonzales    Herrera
        Gonzales    Gonzales
Null    Gonzales    Gonzales

Aucun commentaire:

Enregistrer un commentaire