PHP Questions

Q:

What is Apache configuration file typically called?

Answer

The Apache configuration file is called httpd.conf.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

0 2786
Q:

How do I find out the number of parameters passed into function?

Answer func_num_args() function returns the number of parameters passed in.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

0 2698
Q:

Explain include(), include_once, require() and require_once.

Answer

include()
The include() function takes all the content in a specified file and includes it in the current file. If an error occurs, the include() function generates a warning, but the script will continue execution.

include_once()
File will not be included more than once. If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once().

require()
The require() function is identical to include(), except that it handles errors differently. The require() generates a fatal error, and the script will stop.

require_once()
The required file is called only once when a page is open and further calling of the file will be ignored.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

0 2630
Q:

Will comparison of string "10" and integer 11 work in PHP?

Answer Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

1 2563
Q:

Explain how to work with Permissions in PHP.

Answer

Permissions in PHP are very similar to UNIX. Each file has three types of permissions – Read, write and execute. Permissions can be changed using the change mode or CHMOD command. CHMOD is followed by 3 digit number specifying the permission type. CHMOD 777 is for Read, Write and execute.


Unnecessary permissions can be stripped off using UNMASK command.


Unmask (777);

Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

0 2544
Q:

How do you destroy a particular or all Sessions?

Answer

<?php
session_start();
// store session data
$_SESSION['views']=1;
unset($_SESSION['views']); // If you wish to delete some session data, you can use the unset()
session_destroy(); // You can also completely destroy the session by calling the session_destroy() function. session_destroy() will reset your session and you will lose all your stored session data.
?>

Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

0 2501
Q:

How can we find the number of rows in a result set using PHP?

Answer

$result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";

Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

0 2478
Q:

What’s the difference between htmlentities( ) and htmlspecialchars( )?

Answer htmlspecialchars only takes care of , single quote ‘, double quote " and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP - Technology

0 2460