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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: echoz at k-designs dot com dot sg
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 18:01:23 2020 UTC