⊗ppPmCdIeCh 70 of 447 menu

Checking for Inequality in PHP

There is also the operator !=, which, on the contrary, checks for inequality. Let's check, for example, that the test variable is not equal to 0:

<?php $test = 1; // let the variable value be 1 if ($test != 0) { echo '+++'; // this will work because the variable is NOT equal to 0 } else { echo '---'; } ?>

Let's change the variable value:

<?php $test = 0; // let the variable value be 0 if ($test != 0) { echo '+++'; } else { echo '---'; // this will work because the variable is equal to 0 } ?>

Check that the variable $test is not equal to 10.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline