Sunday, September 23, 2007

php interview questions

Cookies:

PHP transparently supports HTTP cookies as defined by Netscape's Spec. Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. You can set cookies using the setcookie() function. Cookies are part of the HTTP header, so the SetCookie function must be called before any output is sent to the browser. This is the same restriction as for the header() function. Cookie data is then available in the appropriate cookie data arrays, such as $_COOKIE, $HTTP_COOKIE_VARS as well as in $_REQUEST.

Syn:

bool setcookie ( string name [, string value [, int expire [, string path [, string domain [, bool secure]]]]] )



Magic constants

There are five magical constants that change depending on where they are used. For example, the value of __LINE__ depends on the line that it's used on in your script. These special constants are case-insensitive and are as follows:

Table 13-1. A few "magical" PHP constants

Name Description

__LINE__ The current line number of the file.

__FILE__ The full path and filename of the file. If used inside an include, the name of the included file is returned.

__FUNCTION__ The function name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.

__CLASS__ The class name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the class name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.

__METHOD__ The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).

1 comment:

sana ullah said...

For php Interview Questions
Please visit on www.phpinterviewquestion.com

Here you can find PHP,JQuery,Mysql,JS ,wordpress , joomla,drupal questions