FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Using += assignment recursively on an array w/o notice
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Using += assignment recursively on an array w/o notice [message #179586 is a reply to message #179439] Sun, 11 November 2012 14:32 Go to previous messageGo to previous message
Curtis Dyer is currently offline  Curtis Dyer
Messages: 34
Registered: January 2011
Karma:
Member
Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)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);?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem with mysqli_stmt_bind_param()
Next Topic: Message queues not working properly PHP -> C
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 09:03:04 GMT 2024

Total time taken to generate the page: 0.03821 seconds