PHP === and == operators
July 21, 2020
In PHP syntax the == operator (two equality signs) returns true if the compared values are equal, even if they are in different types (for example, 7 == “7” is true).
The === operator (three equality signs) returns true only if the compared values are absolutely equal, i.e. they have equivalent types as well (e.g. 7 === “7” returns false but 7 === 7 returns true).
Another example, p == 0 is true for p being 0, but also for p being “0” (a string containing the character 0).
p === 0 is true only when p is 0.
- Learn PHP reading and searching a free PHP Reference book
- Edit PHP, HTML, CSS, JS, with Codelobster PHP Edition
- QuickPHP lightweight standalone PHP web server to test and debug scripts
- Test Wordpress, PHP, MYSQL and more on a Windows machine, with MS Web Platform Installer
- Host websites featuring PHP, Python, Perl and much more, with Apache HTTP Server
- Run Apache, MySQL, PHP on Windows, even along with IIS, using XAMPP or WampServer
- Download phpBB free PHP bulletin board
- Edit HTML files easily, even with PHP code, using DFM2HTML WYSIWYG editor
- PHP code to detect if a visitor uses the default, query based, Wordpress permalink structure
- PHP get: request query string to redirect
- Convert ASP code to PHP, with Asp2php
- Identify the PHP version of your web site easily