Searching for "php."

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

Q:

Describe how to create a simple AD rotator script without using database in PHP.

Answer

Following are the steps to create a simple AD rotator script without using database in PHP:


- All the ad’s can be collected in one place and be displayed randomly.rand() function can be used for this purpose.


- In order to NOT use any database, a flat file can be used to store the ad’s.


- In order to store the Ad’s information (HTML code), a flat file say “ad.txt” can be created.


- The random number can be stored in a variable 


$result_random=rand(1, 100);


- Conditions can be checked to display the ad’s.


if($result_random<=70)


{


      echo "Display ad1";


}

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

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

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