Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » "undefined dummy-constant" [RSS Feed]

#1 Jan. 5, 2011 18:06:12

Kenan S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

"undefined dummy-constant"

Hello out there.

Recently when I was working on a project, the idea came to my mind: allowing
the usage of undefined "dummy"-flags.

When I am speaking of "undefined dummy-constant", I mean if a variable is
being assigned the constant - and considering it's not defined -
the constant is being internally assigned an unique value.
It's complicated to explain. Maybe, a snippet of code makes you understand
my idea:

// par exemple .. usage in a class:
class XX {
public $x = __XS;

public function foo () {
return $this->x;
$k = new XX;

if ( $k->foo() == __XS ) {
// -- this has been achieved without explicit definition of

// or this way:

$x = __FOO;
$y = __NOOB;
$z = __FOO;

if ( $x == $y ) {
print "This should then not be shown";
} elseif ( $y == $z ) {
print "This should then not be shown either";
} elseif ( $x == $z ) {
print "This would then be finally shown";


The idea behind the implementation - if possible - would then be, in order
to make this and constants work together, it could be checked this way:

If an undefined value is BEING ASSIGNED to a variable or returned by a
function, PHP defines it and assigns an unique - internal - value.
If an undefined value is NOT BEING ASSIGNED and NOT YET DEFINED and, for
instance, used in another context - like usage in a function or if-clause,
PHP falls back to the "Use of undefined constant".

I do not want to allow something like: __X = 2 (__X === 2), but something
like $x = FF; $y = DD; ($x === $y), I think of the dummy-constants not
really being something with a value, but rather something for
"identification" of values.

This might be considered as a request for comments.

Thanks for reading,
*Kenan Sulayman*
*Freelance Designer and Programmer*


  • Root
  • » PHP
  • » "undefined dummy-constant" [RSS Feed]

Board footer

Moderator control

Enjoy the 16th of August

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support