V
V
Vyacheslav2022-02-03 09:58:50
Data Comparison
Vyacheslav, 2022-02-03 09:58:50

Display the matching string from $?

The $data variable can have two options.
either character set kfjnbx8rkj4nh......
or "key not found".
You need to compare the options and display if "key not found" appears.

Seems like a simple question, but I'm confused with these if,else, ==, !=

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MrColdCoffee, 2022-02-03
@MrColdCoffee

If we are talking about php:

if(  (empty($data) && $data!='0' ) || mb_strtolower( trim( $data ) ) == 'ключ не найден' ){
// если нет ключа или не найден...
}else{
//если ключ есть...
}

In short, we write 'Yes' or 'No' to the $result variable, then we output:
$result = (empty($data) && $data!='0' ) || mb_strtolower( trim( $data ) ) == 'ключ не найден' ? 'Нет' : 'Есть';
echo $result;

or like this:
if(  (!empty($data) || $data=='0') && mb_strtolower( trim( $data ) ) != 'ключ не найден' ){
//если ключ есть...
}else{
// если нет ключа или не найден...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question