KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a string that I want to append it some other string. let's say: $my_string = 'Hello'; $my_string .= ' there'; this would return 'Hello there'. I want to make this conditional like this: $my_string = 'Hello'; $append = 'do'; if ( $append == 'do' ) { $my_string .= ' there'; } Now, I want to use a ternary operation to do this, but all the examples I came across are for if/else which will be something like: $my_string .= ( $append == 'do' ) ? ' there' : ''; so is it possible to do it with only IF and without else?
Tags (comma-separated)
Save Edits
Cancel