PHP Questions

Q:

How can we display the output directly to the browser?

Answer

To be able to display the output directly to the browser, we have to use the special tags <?= and ?>.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

7 6958
Q:

What is PHP’s configuration file called ?

Answer

PHP’s configuration file is called php.ini.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

6 3914
Q:

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

Answer

Htmlentities() converts all applicable characters to HTML entities. While htmlspecialcharacter()converts special characters to HTML entities. This means htmlentities( ) will check for non English language characters, such as French accents, the German umlaut, etc.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

3 1909
Q:

PHP allows you to send emails directly from a script.

php allows you to send emails directly from a script

A) TRUE B) FALSE
Answer & Explanation Answer: A) TRUE

Explanation:

The mail() function allows you to send emails directly from a script.


 

Report Error

View Answer Workspace Report Error Discuss

Subject: PHP
Exam Prep: Bank Exams
Job Role: IT Trainer , Project Manager , Software Architect

2 2348
Q:

Why was PHP developed, what it is used for, and where can you get it?

Answer

PHP developed for less script, time saving, Free Open Source Software and runs on different platforms such as Windows, Linux, Unix, etc. PHP compatible with almost all servers used today such as Apache, IIS, etc.

The PHP scripting language resembles JavaScript, Java, and Perl, These languages all share a common ancestor, the C programming language. PHP has full access to the information that the server has, and very little access to information that the client has. In fact, it only has information that the client tells the server and that the server passes on to PHP. Because it is on the server, however, PHP cannot be modified by the client. While you cannot necessarily trust the information that the client gives to PHP, you can trust that your PHP is doing what you told it to do. Because PHP is on the server end, your PHP scripts can affect your server -- such as by keeping an activity log or updating a database.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

2 9820
Q:

What is the difference between Notify URL and Return URL?

Answer

Notify URL and Return URL is used in Paypal Payment Gateway integration. Notify URL is used by PayPal to post information about the transaction. Return URL is used by the browser; A url where the user needs to be redirected on completion of the payment process.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

2 3663
Q:

What is the purpose $_PHP_SELF variable?

Answer

The PHP default variable $_PHP_SELF is utilized for the PHP script name and when you click "submit" catch then same PHP script will be called.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP
Job Role: IT Trainer

2 5588
Q:

How can I retrieve values from one database server and store them in other database server using PHP?

Answer

we can always fetch from one database and rewrite to another. Here is a nice solution of it.$db1 = mysql_connect("host","user","pwd")
mysql_select_db("db1", $db1);
$res1 = mysql_query("query",$db1);$db2 = mysql_connect("host","user","pwd")
mysql_select_db("db2", $db2);
$res2 = mysql_query("query",$db2);At this point you can only fetch records from you previous ResultSet, i.e $res1 – But you cannot execute new query in $db1, even if you supply the link as because the link was overwritten by the new db.so at this point the following script will fail
$res3 = mysql_query("query",$db1); //this will failSo how to solve that?

take a look below.
$db1 = mysql_connect("host","user","pwd")
mysql_select_db("db1", $db1);
$res1 = mysql_query("query",$db1);

$db2 = mysql_connect("host","user","pwd", true)
mysql_select_db("db2", $db2);
$res2 = mysql_query("query",$db2);

So mysql_connect has another optional boolean parameter which indicates whether a link will be created or not, as we connect to the
$db2 with this optional parameter set to 'true', so both link will remain live.

Now the following query will execute successfully.
$res3 = mysql_query("query",$db1);

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

1 10113