| 6 comments ]

1 When uploading a file using HTTP, which variable can be used to locate the file on PHP's local filesystem?


Answer...
None of the above
$_FILES['fieldname']['tmp_name']
$_FILES['fieldname']
$_FILES['fieldname'][0]['filename']
$_FILES['fieldname']['filename']

ans : $_FILES['fieldname']['tmp_name']


2 Which of the following SQL statements will improve SQLite write performance?


Answers: (choose 2)
PRAGMA locking_mode = "Row";
PRAGMA count_changes = Off;
PRAGMA default_synchronous = Off;
PRAGMA default_synchronous = On;
PRAGMA locking_mode = "Table";

Ans:

3 What is the best way to iterate and modify every element of an array using PHP 5?

Answer...
You cannot modify an array during iteration
for($i = 0; $i < count($array); $i++) { /* ... */ }
foreach($array as $key => &$val) { /* ... */ }
foreach($array as $key => $val) { /* ... */ }
while(list($key, $val) = each($array)) { /* ... */

4 What is the primary benefit of a SAX-based XML parser compared to DOM?




Please answer through the comments I will make it publish on blog..............

6 comments

nkhanchandani said... @ Sunday, April 27, 2008 at 3:43:00 PM GMT+1

for($i = 0; $i < count($array); $i++) { /* ... */ } is correct answer

nkhanchandani said... @ Sunday, April 27, 2008 at 4:23:00 PM GMT+1

for question 2:

PRAGMA count_changes = Off;
PRAGMA default_synchronous = Off;

nkhanchandani said... @ Sunday, April 27, 2008 at 4:26:00 PM GMT+1

for question 1:
$_FILES['fieldname']['tmp_name']

tjmcd1963 said... @ Saturday, October 4, 2008 at 9:05:00 PM GMT+1

nkhanchandani said...
for($i = 0; $i < count($array); $i++) { /* ... */ } is correct answer
for($i = 0; $i < count($array);
Sorry, I don't think so.
for($i = 0; $i < count($array); $i++) { /* DO WHAT EXACTLY??? */ }
Can you give an example simpler than...

$array =range('A', 'Z');
foreach($array as $key=> &$value){
$value= $i++;
}
print_r($array);

tahsin said... @ Thursday, July 30, 2009 at 7:05:00 PM GMT+1
This comment has been removed by a blog administrator.
Igor said... @ Tuesday, December 8, 2009 at 6:56:00 PM GMT

tjmcd1963, read that - What is the best way to iterate and MODIFY

foreach needs array_keys to modify input array, so the right answer is for(...)

Post a Comment

Please put your comments here. your questions, your suggestions, also what went wrong with me.