variables
<?php
declare(strict_types=1);
$label = "0x1RIS";
$port = 443;
Strict types
declare(strict_types=1) changes how arguments are checked
Without it PHP coerces a numeric string into an int silently
With it the call fails loudly
Put it at the top of new files
Scalars
string , int , float , bool
array and object are not scalars
null is its own type
The old cheat sheet listed integer ranges from a 32 bit world Those numbers are no longer a useful mental model
Constants
const MAX_PORT = 65535;
Constants cannot be reassigned
Use final class constants for grouped values
Deprecated aliases
PHP 8.6 deprecates is_double , is_long , is_integer , and doubleval
Use is_float , is_int , and floatval
Writing the old names in new content would be teaching debt
Next
Arrays in 03 arrays
Posted