“:: in PHP” Code-Antworten

:: in PHP

/*
The Scope Resolution Operator (also called Paamayim Nekudotayim) 
or in simpler terms, the double colon, is a token that allows 
access to static, constant, and overridden properties or methods 
of a class.
*/
class MyClass {
    const CONST_VALUE = 'A constant value';
}

$classname = 'MyClass';
echo $classname::CONST_VALUE;

echo MyClass::CONST_VALUE;
CoderHomie

: in PHP

/*
This is an easy way to execute conditional html / 
javascript / css / other language code with 
php if else:

No need for curly braces {}
*/
<?php if (condition): ?>

// html / javascript / css / other language code to run if condition is true

<?php else: ?>

// html / javascript / css / other language code to run if condition is false

<?php endif ?>
CoderHomie

Ähnliche Antworten wie “:: in PHP”

Fragen ähnlich wie “:: in PHP”

Weitere verwandte Antworten zu “:: in PHP” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen