i'm new in php and i have problems with this piece of code
i do not figure out , why 'echo' prints : x ? error 3000
3000 is a key , indeed should be printing "scanner error" ...
what's wrong in my code ? thank you to every one ...
<?php
// ....................................... sym
class Error
{
const lexer = 1000 ;
const parser = 2000 ;
const scanner = 3000 ;
}
final class err extends Error
{
public $stringerr = array (
lexer => "Lexer error" ,
parser => "Parser error" ,
scanner => "Scanner error"
) ;
public function error ( $x )
{
echo "\nx" . " ? " . $stringerr[ $x ] . " error ";
return $x ;
}
}
?>
echo err::error( err::scanner ) ;
output :
x ? error 3000