Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7517

Re: Using += assignment recursively on an array w/o notice

From Curtis Dyer <dyer85@gmail.com>
Newsgroups comp.lang.php
Subject Re: Using += assignment recursively on an array w/o notice
Date 2012-11-11 14:32 +0000
Organization A noiseless patient Spider
Message-ID <k7ocur$tsj$1@dont-email.me> (permalink)
References <k6jpko$7rr$1@dont-email.me> <2044507.2AoWnWmAXe@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote:

> Scott Johnson wrote:
> 
>> I am pulling data from a DB that represent products and product
>> options. 

<snip>

>> $item[$data['ProductName']]['TotalQty'] =
>> isset($item[$data['ProductName']]['TotalQty']) ?
>> $item[$data['ProductName']]['TotalQty'] + $data['Qty'] :
>> $data['Qty']; 

<snip>

>> Is there a statement that will give me something simpler then
>> this or is this just the way to do it.
> 
> First of all, ask yourself why you have to care about notices. 
> They are good for development but should be hidden in
> production, even from log files, so as not to make a junk file.
> 
> Second, you can define what messages you see:
> 
>   /* Disable notices */
>   error_reporting(error_reporting() ^ E_NOTICE);

Just a small note for those who might use this code in contexts in 
which PHP's error reporting is already set to ignore notices:  this 
code would actually enable notices (where permission to do so 
allows).

If you want code to disable notices in an idempotent fashion, try 
instead:

  error_reporting(error_reporting() & ~E_NOTICE);

<snip>


@OP: more info on the error reporting function: 
<http://php.net/error_reporting>

-- 
Curtis Dyer
<?$x='<?$x=%c%s%c;printf($x,39,$x,39);?>';printf($x,39,$x,39);?>

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Using += assignment recursively on an array w/o notice Scott Johnson <noonehome@chalupasworld.com> - 2012-10-28 10:21 -0700
  Re: Using += assignment recursively on an array w/o notice Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-28 21:09 +0100
    Re: Using += assignment recursively on an array w/o notice Curtis Dyer <dyer85@gmail.com> - 2012-11-11 14:32 +0000
  Re: Using += assignment recursively on an array w/o notice Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-28 21:37 +0000

csiph-web