PHP Questions

Q:

What is the difference between characters 23 and x23?

Answer The first one is octal 23, the second is hex 23
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 3568
Q:

With a heredoc syntax, do I get variable substitution inside the heredoc contents?

Answer Yes
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

1 3489
Q:

Would you initialize your strings with single quotes or double quotes?

Answer Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

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

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

1 3158
Q:

So if md5( ) generates the most secure hash, why would you ever use the less secure crc32( ) and sha1( )?

Answer Crypto usage in PHP is simple, but that doesn’t mean it’s free. First off, depending on the data that you’re encrypting, you might have reasons to store a 32-bit value in the database instead of the 160-bit value to save on space. Second, the more secure the crypto is, the longer is the computation time to deliver the hash value. A high volume site might be significantly slowed down, if frequent md5() generation is required.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 3069
Q:

How can we get the browser properties using PHP?

Answer

By using
$_SERVER['HTTP_USER_AGENT']
variable.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 3065
Q:

What does a special set of tags do in PHP?

Answer The output is displayed directly to the browser.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 3007