ARTICLES > PHP

PHP code notice use of undefined constant - assumed Turn Back

2016-09-15 12:20:01

 

In the newer PHP3 is not supported. Errors caused by the variable declaration without single or double quote.

<?php

$id = $_GET[id];

?>

Error reporting

Notice: Use of undefined constant id - assumed 'id' in C:xampphtdocs estindex.php on line 2

 

Resolve: adding  ', " to constant id

$id = $_GET['id'];  

// or 

$id = $_GET["id"];

 

You can hidden an error with disable all error report (Not recommend)

error_reporting(E_ALL ^ E_NOTICE);

This code for hidden all error and notice

 

Turn Back