Page 1 of 1

Use of undefined constant NIL

PostPosted: 11. June 2015 11:10
by mo3awia
when a variable value is NIL , xampp prints an error message on browser
the message is "Use of undefined constant NIL"
i don't want to hide errors in php.ini
I want to solve this problem
By the way it works fine on mamp on (mac and windows) and wamp

Re: Use of undefined constant NIL

PostPosted: 11. June 2015 13:00
by Nobbie
mo3awia wrote:when a variable value is NIL , xampp prints an error message on browser
the message is "Use of undefined constant NIL


Because there is no constant called "NIL". It is "NULL" instead:

http://php.net/manual/en/language.types.null.php

Re: Use of undefined constant NIL

PostPosted: 11. June 2015 16:01
by mo3awia
there is a 'NIL' in php and editors don't have a problem with it
and i said it works fine at mac , windows and on a online server not just local server

Re: Use of undefined constant NIL

PostPosted: 11. June 2015 18:05
by Nobbie
Ok, you know it better than me and better than the PHP documentation. And even better than the PHP interpreter, which gives you that error message.

Re: Use of undefined constant NIL

PostPosted: 11. June 2015 18:14
by glitzi85
mo3awia wrote:there is a 'NIL' in php and editors don't have a problem with it
and i said it works fine at mac , windows and on a online server not just local server

First of all, there is no NIL unless you define it:
Code: Select all
define('NIL', null);

Are you comparing the same script and the same php configuration (and exact version) on all environments?

What code are we talking about? In a Framework this might be defined because it is derived from another programming language where nil is used instead of null?
----------------------------------------------------
EDIT: Scratch that. Testscript:
Code: Select all
<?php
var_dump(NIL);
?>

Windows (PHP 5.5.15): int(0)
Arch (PHP 5.6.9): int(0)
Ubuntu (PHP 5.5.9): string(3) "NIL"

I will investigate that.

Re: Use of undefined constant NIL

PostPosted: 11. June 2015 18:37
by glitzi85