|
1. What Is a Persistent Cookie? A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You should decide when to use temporary cookies and when to use persistent cookies based on their differences: *Temporary cookies can not be used for tracking long-term information. *Persistent cookies can be used for tracking long-term information. *Temporary cookies are safer because no programs other than the browser can access them. *Persistent cookies are less secure because users can open cookie files see the cookie values. 2. What is the difference between mysql_fetch_object and mysql_fetch_array? MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array. 3. How can we encrypt the username and password using PHP? Answer1 You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD("Password"); Answer2 You can use the MySQL PASSWORD() function to encrypt username and password. For example, INSERT into user (password, ...) VALUES (PASSWORD($password”)), ...); 4. How do you pass a variable by value? Just like in C++, put an ampersand in front of it, like $a = &$b 5. If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b? 100, it’s a reference to existing variable. 6. What is meant by PEAR in php? Answer1: PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a nicely organised OOP library. PEAR also provides a command-line interface that can be used to automatically install "packages" Answer2: PEAR is short for "PHP Extension and Application Repository" and is pronounced just like the fruit. The purpose of PEAR is to provide: - A structured library of open-sourced code for PHP users
- A system for code distribution and package maintenance
- A standard style for code written in PHP
- The PHP Foundation Classes (PFC),
- The PHP Extension Community Library (PECL),
- A web site, mailing lists and download mirrors to support the PHP/PEAR community
PEAR is a community-driven project with the PEAR Group as the governing body. The project has been founded by Stig S. Bakken in 1999 and quite a lot of people have joined the project since then. 7. What is the difference between $message and $$message? They are both variables. But $message is a variable with a fixed name. $$message is a variable who's name is stored in $message. For example, if $message contains "var", $$message is the same as $var. 8. What are "GET" and "POST"? GET and POST are methods used to send data to the server: With the GET method, the browser appends the data onto the URL. With the Post method, the data is sent as "standard input." Major Difference In simple words, in POST method data is sent by standard input (nothing shown in URL when posting while in GET method data is sent through query string. Example : Assume we are logging in with username and password. GET : we are submitting a form to login.php, when we do submit or similar action, values are sent through visible query string (notice ./login.php?username=...&password=... as URL when executing the script login.php) and is retrieved by login.php by $_GET['username'] and $_GET['password']. POST : we are submitting a form to login.php, when we do submit or similar action, values are sent through invisible standard input (notice ./login.php) and is retrieved by login.php by $_POST['username'] and $_POST['password']. POST is assumed more secure and we can send lot more data than that of GET method is limited (they say Internet Explorer can take care of maximum 2083 character as a query string). 9. How do I find out the number of parameters passed into function9? func_num_args() function returns the number of parameters passed in. 10. When are you supposed to use endif to end the conditional statement? When the original if was followed by : and then the code block without braces.
|