Skip to content
Advertisement

When the value is empty, I want to print something else on a page

I have a simple code that I want when the name of a bank is empty and a site binlist has not obtained it from a database that writes something else in its place, for example : N/A

JavaScript

Advertisement

Answer

Why not simply check if it empty and assign the value in this case?

For example:

$bankname = empty($details['bank']['name']) ? 'N/A' : strtoupper($details['bank']['name']);

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement