PHP 8.5.0 Beta 3 available for testing

Voting

: min(three, six)?
(Example: nine)

The Note You're Voting On

kawewong at gmail dot com
5 days ago
To set constant using `define()` will not work with `namespace` unlike using `const`.

Example:
<?php
namespace MyProject;

const
IS_IT_CONNECTED = true; // will be able to access via `\MyProject\IS_IT_CONNECTED`

define('START_TIME', time());// will be able to access via `START_TIME` only, not be able to access via ---`\MyProject\START_TIME`---
?>

Call:
<?php
var_dump
(\MyProject\IS_IT_CONNECTED);// true

var_dump(START_TIME);// numbers

var_dump(\MyProject\START_TIME);// Fatal error: Uncaught Error: Undefined constant...
?>

<< Back to user notes page

To Top