I heard that a heavily commented script runs slightly slower than a non-commented one. Is it true? Did anyone test this? (like how much slower is it in percentages) Answer Commenting will not affect the script execution time in normal case. But the number of lines you write in your code affect the parser to r…
PHP PDO extension not working on IIS
I have a script which uses __autoload() to load classes (stupid, I know, this is old code I used to use for fun / testing), and it seems to be trying to autoload PDO. This leads me to believe that it’s not finding the PDO class it should be. I have checked php.ini and php_pdo.dll is enabled, along with …
Excel output with codeigniter
I’m trying to get a report from my codeigniter project in excel, but I am at a complete loss on how to do it. It already works well, just would like the output in excel rather then a page. Any tips/pointers/explanations? thanks! Answer I’ll refer you to this wiki article from the codeIgniter site,…
Parse query string into an array
How can I turn a string below into an array? pg_id=2&parent_id=2&document&video This is the array I am looking for, array( ‘pg_id’ => 2, ‘parent_id’ => 2, ‘document’ =…
calling php file fron another php file while passing arguments
i need to call a php inside another php file and pass some arguments also. how can i do this?? i tried include(“http://…/myfile.php?file=$name”); but gives access denied. i read like v must not …
How to generate Unique Order Id (just to show touser) with actual Order Id?
EDIT AGAIN : I don’t want to create another question, so asking here. I have the same situation. But this time I need the algo in C language. Can any body help me. I have following table. CREATE …
PHP: a short cut for isset and !empty?
I wonder if there any better ideas to solve the problem below, I have a form with a number of input fields, such as, But sometimes don’t need certain input fields above in my form, for instance, I only need the page title for my db injection, And I have another php page to handle the $_POST data, Every …
How to create an empty array in PHP with predefined size?
I am creating a new array in a for loop. PHP keeps complaining about the offset since for each iteration I add a new index for the array, which is kind of stupid. Is there some way to predefine the number items in the array so that PHP will not show this notice? In other words, can I predefine the
Adding an item to an associative array
//go through each question foreach($file_data as $value) { //separate the string by pipes and place in variables list($category, $question) = explode(‘|’, $value); //place in assoc array $…
PHP Fatal Error Failed opening required File
I am getting the following error from Apache [Sat Mar 19 23:10:50 2011] [warn] mod_fcgid: stderr: PHP Fatal error: require_once() [function.require]: Failed opening required ‘/common/configs/config_templates.inc.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/viapics1/p…