P
P
PanCar2021-06-23 19:44:33
PHP
PanCar, 2021-06-23 19:44:33

Why doesn't it output text?

Good day. It should have output "test message" in the end, but it outputs "why". Why? Sorry if this is a dumb question. Thanks in advance.

$gg = [
  'тестовое сообщение'
];

$what = 'тестовое сообщение';
$test = $what;
echo $test;
if ($test == $gg) {
  echo "1";
} else {
  echo "why";
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-06-23
@PanCar

In the first case a string, in the second an array
$test == $gg[0]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question