php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #11070 '@' does not turn off error checking in foreach()
Submitted: 2001-05-23 18:47 UTC Modified: 2001-08-28 04:19 UTC
From: lee at mediawaveonline dot com Assigned:
Status: Duplicate Package: Feature/Change Request
PHP Version: 4.0.5 OS: linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lee at mediawaveonline dot com
New email:
PHP Version: OS:

 

 [2001-05-23 18:47 UTC] lee at mediawaveonline dot com
it would be nice to see the '@' turn off error reporting on the foreach() command. ie.

<?php
  foreach($test as $pos => $val)
  {

  }
?>
gives an error because $test is not set.

<?php
  foreach(@$test as $pos => $val)
  {

  }
?>
gives an error because its the wrong data type.

<?php
  @foreach($test as $pos => $val)
  {

  }
?>
gives a syntax error. it would be nice if this last command worked :)

  Chris Lee
  lee@mediawaveonline.com


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-23 18:52 UTC] cnewbill@php.net
Use....

if (is_array($a))
    foreach ($a as $key => $val) {
        /* Do something */
    }

....until it is added, which it may not be.

-Chris
 [2001-08-28 04:19 UTC] sander@php.net
Duplicate of 6118.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC