Rophs Posted February 4, 2015 Report Posted February 4, 2015 [attachment=4487:foreach_quest_bar_rpcq.png]\ The warning/error is not produced when atleast one clickie is clicked. This is probably because foreach doesn't know how to handle zero things. I propose a solution: try { //foreach stuff here } catch (Exception $e) { echo "You need to click the checkboxes next to the clickies you wish to maintain."; } Quote
Root Admin Chewett Posted February 4, 2015 Root Admin Report Posted February 4, 2015 foreach_quest_bar_rpcq.png\ The warning/error is not produced when atleast one clickie is clicked. This is probably because foreach doesn't know how to handle zero things. I propose a solution: try { //foreach stuff here } catch (Exception $e) { echo "You need to click the checkboxes next to the clickies you wish to maintain."; } For those interested, the proper solution is: //Checks to make sure $data is an array before iterating if(is_array($data)) { foreach($data as $d) { //do somethign with $d } } Quote
I am Bored Posted February 4, 2015 Report Posted February 4, 2015 Because, regardless of the language, exceptions are expensive. Of course, depending on the language, *cough*MaxScript*cough* returns, breaks, and continues can also be expensive... (for some absurd reason Autodesk implemented them using C++ exceptions internally) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.