php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9881 Varibles are not defined
Submitted: 2001-03-20 14:56 UTC Modified: 2001-03-20 15:12 UTC
From: echoz at k-designs dot com dot sg Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.0.4pl1 OS: Win95
Private report: No CVE-ID: None
 [2001-03-20 14:56 UTC] echoz at k-designs dot com dot sg
<?php
switch ($e) {

case "list";
// do this
break;

case "add";
// do that
break;
}
?>

everytime i call the script without the varible "e" specified... they will return "Warning: Undefined variable: e in e:somewheresomehow on line 14"

please help.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-20 15:11 UTC] derick@php.net
Read www.php.net/error_reporting please, this is not a bug
 [2001-03-20 15:12 UTC] torben@php.net
Well, define $e then. ;) Or put a '@' in front of it
to suppress the error. Or turn down the error_reporting().
Check the manual for more information on using the
language:

  http://www.php.net/manual

And especially the section on error handling:

  http://www.php.net/manual/en/features.error-handling.php


 [2001-03-20 15:12 UTC] hholzgra@php.net
because you are using $e in the switch statement
although it has never been given a value before

if this annoies you turn of E_NOTICE warning level

or wrap your switch into 

if(isset($e)) {
 ...
}
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jan 27 20:01:24 2021 UTC