[FX.php List] Which is faster?

Chris Hansen chris at iViking.org
Mon Sep 13 08:45:42 MDT 2010


Bob, et al...

Okay, here are some thoughts, pointers, etc.:

1) Try using var_dump() rather than print_r().  This is something that  
I first heard advocated by Lance Hallberg and it's a nice function.   
It gives you not only the structure, but the number of elements and  
the type (so it's nice for troubleshooting === and !== as well...)   
Also, var_dump() can be used for any expression so it's a good all- 
around tool.

2) Bob, I think I noticed that you were missing the trailing brackets  
in those checkboxes as Jonathan had indicated.  So, for you or any  
newer folks out there, here is the standard way to use checkboxes  
dynamically:

<input type='checkbox' name='my_name[]' value='??someValue??'>

where, of course, ??someValue?? needs to be your dynamic value.  The  
reason to do things this way is that on submit, the input whose name  
is followed by those empty brackets is automagically turned into an  
array by PHP on submit.  Handy!

3) Personally, I don't see anything iffy about not using a database in  
a given transaction.  Granted, I may not have understood the question,  
but I avoid sticking anything in a database unless I need access to  
that data down the line.

Best,

--Chris


More information about the FX.php_List mailing list