PHP Questions

Q:

How do you pass a variable by value?

Answer Just like in C++, put an ampersand in front of it, like $a = &$b
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2330
Q:

How to set cookies in PHP?

Answer

The function setcookie() is used to define a cookie that is to be sent along with HTTP headers. The cookie must be sent prior to any output from the script as is the protocol restriction. After setting the cookies, they can be used when the next page is loaded by using $_COOKIE or $HTTP_COOKIE_VARS arrays.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2327
Q:

What is the use of super-global arrays in PHP?

Answer

Super global arrays are the built in arrays that can be used anywhere. They are also called as auto-global as they can be used inside a function as well. The arrays with the longs names such as $HTTP_SERVER_VARS, must be made global before they can be used in an array. This $HTTP_SERVER_VARS check your php.ini setting for long arrays.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2324
Q:

What is the difference between PHP and JavaScript?

Answer

The difference lies with the execution of the languages. PHP is server side scripting language, which means that it can’t interact directly with the user. Whereas, JavaScript is client side scripting language, that is used to interact directly with the user.


 

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2321
Q:

What is PHP?

Answer

PHP: Hypertext Preprocessor is open source server-side scripting language that is widely used for web development. PHP scripts are executed on the server. PHP allows writing dynamically generated web pages efficiently and quickly. The syntax is mostly borrowed from C, Java and perl. PHP is free to download and use.


 

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2321
Q:

Which function would you use to insert a record into a database?

Answer

The dba_insert() function adds a record to a database.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2316
Q:

Are objects passed by value or by reference?

Answer Everything is passed by value.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2260
Q:

What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?

Answer

mysql_fetch_array:
Fetch a result row as an associative array and a numeric array.

mysql_fetch_object:
Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows.

mysql_fetch_row():
Fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2229