PHPda qisqartirilgan operatsiyalarning nuanslari
E'tibor bering, qisqartirilgan operatsiyalarda solishtirish
== bo'yicha amalga oshiriladi, === bo'yicha emas.
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = 3;
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = 'abc';
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = '';
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = 3 * 'abc';
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = null;
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = false;
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test;
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = 0;
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = '0';
if ($test) {
echo '+++';
} else {
echo '---';
}
?>
Kodni ishlamasdan, ekranda chiqadigan natijani aniqlang:
<?php
$test = -1;
if ($test) {
echo '+++';
} else {
echo '---';
}
?>