Expressions are the most important cornerstone of PHP. In PHP, almost everything you write is an expression . The simple but most precise way to define an expression is "anything with a value".
The most basic expression forms are constants and variables. When typing "$a = 5", the value "5" is assigned to the variable $a. "5", obviously, has the value 5, in other words "5" is an expression with the value 5 (here, "5" is an integer constant).
After the assignment, the expectation is that the value of $a is 5, so if we write $b = $a, the expectation is that it will be the same as $b = 5. In other words, $a is an expression that also evaluates to 5. If everything works correctly, this is exactly what is going to happen.
Some expressions can be treated as statements. At this time, the form of a statement is 'expr' ';', that is, an expression ends with a semicolon. In "$b=$a=5;", $a=5 is a valid expression, but it is not a statement in itself. "$b=$a=5;" is a valid statement.
Recommended: php server
The above is the detailed content of Can PHP constants be expressions?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
