PHP Questions

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

1 2700
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

0 2688
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

0 2671
Q:

Explain the different types of errors in PHP.

Answer

Notices, Warnings and Fatal errors are the types of errors in PHP


Notices: 


Notices represents non-critical errors, i.e. accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all but whenever required, you can change this default behavior.


Warnings: 


Warnings are more serious errors but they do not result in script termination. i.e calling include() a file which does not exist. By default, these errors are displayed to the user.


Fatal errors: 


Fatal errors are critical errors i.e. calling a non-existent function or class. These errors cause the immediate termination of the script.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2536
Q:

If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b?

Answer 100, it’s a reference to existing variable.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2526
Q:

Explain how to send large amounts of emails with php.

Answer

The mail() function of PHP is quite robust for sending bulk emails. A SMTP server can also be directly used from the script. PHPmailer class can be used for sending emails.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2512
Q:

What is PEAR in php?

Answer

PEAR(PHP Extension and Application Repository) is a framework and repository for reusable PHP components. PEAR is a code repository containing all kinds of php code snippets and libraries. 


PEAR also offers a command-line interface that can be used to automatically install "packages".

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2512
Q:

What is the functionality of the function strstr and stristr?

Answer

strstr() returns part of a given string from the first occurrence of a given substring to the end of the string.
For example:
strstr("user@example.com","@") will return "@example.com".

stristr() is idential to strstr() except that it is case insensitive.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2494