PHP 8.5.0 Alpha 1 available for testing

Voting

: max(five, seven)?
(Example: nine)

The Note You're Voting On

r dot hartung at roberthartung dot de
15 years ago
You can use the late static command "static::" withing defined as well. This example outputs - as expected - "int (2)"

<?php
abstract class class1
{
public function
getConst()
{
return
defined('static::SOME_CONST') ? static::SOME_CONST : false;
}
}

final class
class2 extends class1
{
const
SOME_CONST = 2;
}

$class2 = new class2;

var_dump($class2->getConst());
?>

<< Back to user notes page

To Top