1. WHAT IS THE DIFFERENCE BETWEEN GET & POST?
Get is an Idompotent method. (Idompotent: The side-effects of N > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and DELETE share this property.)”GET” is basically for just getting (retrieving: quering db for data & retriving) data whereas “POST” may involve anything, like storing or updating data, or ordering a product, or sending E-mail. In GET form data is to be encoded (by a browser) into a URL while the latter means that the form data is to appear within a message body. For GET in IE, Maximum URL Length Is 2,083 Characters in Internet Explorer (Q208427) or approximatly 1k.
2. WHO IS THE FATHER OF PHP AND WHAT IS THE CURRENT IN PHP & MYSQLVERSION?
Rasmus Lerdorf.
PHP 5.1. Beta
MySQL 5.0
3. HOW CAN WE SUBMIT A FORM WITHOUT A SUBMIT BUTTON?
form.submit();
4. IN HOW MANY WAYS WE CAN RETRIEVE THE DATE IN THE RESULT SET OF MYSQL USING PHP?
mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both
mysql_fetch_assoc — Fetch a result row as an associative array
mysql_fetch_object — Fetch a result row as an object
mysql_fetch_row — Get a result row as an enumerated array
5.WHAT IS THE DIFFERENCE BETWEEN MYSQL_FETCH_OBJECT AND MYSQL_FETCH_ARRAY?
mysql_fetch_array — Fetch a result row as an associative ARRAY, a numeric array, or both
mysql_fetch_object — Fetch a result row as an OBJECT
6. WHAT IS THE DIFFERENCE BETWEEN $MESSAGE AND $$MESSAGE?
$message is a variable
$$message is a variable variable.
A variable variable allows us to change the name of a variable dynamically.
7. HOW CAN WE EXTRACT STRING ‘ABC.COM’ FROM A STRING ‘HTTP://INFO@ABC.COM’ USING REGULAR EXPRESSION OF PHP?
8. HOW CAN WE CREATE A DATABASE USING PHP AND MYSQL?
$sql = ‘CREATE DATABASE my_db’;
if (mysql_query($sql, $link))
{
echo “Database my_db created successfully\n”;
}
else
{
echo ‘Error creating database: ‘ . mysql_error() . “\n”;
}
9. WHAT ARE THE DIFFERENCES BETWEEN REQUIRE AND INCLUDE, INCLUDE_ONCE?
All three are used to an include file into the current page. It is faster than include().
If the file is not present, require(), calls a fatal error, while in include() does not.
The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. It des not call a fatal error if file not exists. require_once() does the same as include_once(), but it calls a fatal error if file not exists.
10. CAN WE USE INCLUDE (”ABC.PHP”) TWO TIMES IN A PHP PAGE “MAKEIT.PHP”?
YES
11. WHAT ARE THE DIFFERENT TABLES PRESENT IN MYSQL, WHICH TYPE OF TABLE IS GENERATED WHEN WE ARE CREATING A TABLE IN THE FOLLOWING SYNTAX: CREATE TABLE EMPLOYEE(ENO INT(2),ENAME VARCHAR(10)) ?
MyISAM: This is default. Based on Indexed Sequntial Access Method. The above SQL will create a MyISA table.
ISAM : same
HEAP : Fast data access, but will loose data if there is a crash. Cannot have BLOB, TEXT & AUTO INCRIMENT fields
BDB : Supports Transactions using COMMIT & ROLLBACK. Slower that others.
InoDB : same as BDB
12. FUNCTIONS IN IMAP, POP3 AND LDAP?
imap_body — Read the message body
imap_check — Check current mailbox
imap_delete — Mark a message for deletion from current mailbox
imap_mail — Send an email message
13. HOW CAN I EXECUTE A PHP SCRIPT USING COMMAND LINE?
As of version 4.3.0, PHP supports a new SAPI type (Server Application Programming Interface) named CLI which means Command Line Interface.
14. SUPPOSE YOUR ZEND ENGINE SUPPORTS THE MODE THEN HOW CAN U CONFIGURE YOUR PHP ZEND ENGINE TO SUPPORT MODE ?
Its already supported.
15. WHAT IS MEANT BY NL2BR()?
Returns string with after inserting HTML line breaks before all newlines in a string
16. HOW CAN WE ENCRYPT AND DECRYPT A DATA PRESENT IN A MYSQL TABLE USING MYSQL?
AES_ENCRYPT(str,key_str) , AES_DECRYPT(crypt_str,key_str)
17. ENCRYPTION FUNCTIONS IS PHP
CRYPT()
MD5()
18. WHAT ARE THE DIFFERENCES BETWEEN PUBLIC, PRIVATE, PROTECTED, STATIC, TRANSIENT, FINAL AND VOLATILE?
19. WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP?
here are three basic types of runtime errors in PHP:
1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script - for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all - although you can change this default behaviour.
2. Warnings: These are more serious errors - for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
3. Fatal errors: These are critical errors - for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behaviour is to display them to the user when they take place.
Internally, these variations are represented by twelve different error types
20. WHAT IS THE FUNCTIONALITY OF THE FUNCTIONS STRSTR() AND STRISTR()?
string strstr ( string haystack, string needle )
Returns part of haystack string from the first occurrence of needle to the end of haystack.
$email = ‘user@example.com’;
$domain = strstr($email, ‘@’);
echo $domain; // prints @example.com
stristr() is the case insensitive version of strstr()
21. DIFFERENCE BETWEEN HTMLENTITIES() AND HTMLSPECIALCHARS()]
htmlspecialchars : Convert some special characters to HTML entities (Only the most widley used)
htmlentities : Convert ALL special characters to HTML entities
22. WHAT IS MEANT BY URLENCODE AND URLDOCODE?
urlencode : Returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs.
urldocode : Decodes URL-encoded string
23. WHAT IS THE DIFFERENCE BETWEEN THE FUNCTIONS UNLINK AND UNSET?
unlink: is used to delete a file
unset is used to destroy an eralier declared variable
24. HOW CAN WE REGISTER THE VARIABLES INTO A SESSION?
$_SESSION[’name’] = “Chinmay”;
To destroy a session: unset($_SESSION[’name’]);
25. HOW CAN WE GET THE PROPERTIES (SIZE, TYPE, WIDTH, HEIGHT) OF AN IMAGE USING PHP IMAGE FUNCTIONS?
getimagesize — Get the size of an image
image_type_to_extension — Get file extension for image type
imagesx — Get image width
imagesy — Get image height
26. UPLOAD FILE SIZE
In Php.ini file: upload_max_filesize integer
The maximum size of an uploaded file.
When an integer is used, the value is measured in bytes.
27. HOW CAN WE INCREASE THE EXECUTION TIME OF A PHP SCRIPT?
Use set_time_limit(int) where int is the number of seconds for
execution of the script. If it’s set to 0 it’s unlimited. Default value
is 30.
28. HOW CAN WE TAKE A BACKUP OF A MYSQL TABLE AND HOW CAN WE RESTORE IT. ?
To backup: BACKUP TABLE tbl_name[,tbl_name…] TO ‘/path/to/backup/directory’
RESTORE TABLE tbl_name[,tbl_name…] FROM ‘/path/to/backup/directory’
mysqldump: Dumping Table Structure and Data
Utility to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump will contain SQL statements to create the table and/or populate the table.
-t, –no-create-info
Don’t write table creation information (the CREATE TABLE statement).
-d, –no-data
Don’t write any row information for the table. This is very useful if you just want to get a dump of the structure for a table!
29. OPTIMISING QUERIES
First, one thing that affects all queries: The more complex permission system setup you have, the more overhead you get.
If you do not have any GRANT statements done, MySQL will optimise the permission checking somewhat. So if you have a very high volume it may be worth the time to avoid grants. Otherwise, more permission check results in a larger overhead.
30. COOKIES
setcookie(”variable”,”value”,”time”);
variable - name of the cookie variable
variable - value of the cookie variable
time - expiry time
Example: setcookie(”test”,$i,time()+3600);
Test - cookie variable name
$i - value of the variable ‘Test’
time()+3600 - denotes that the cookie will expire after an one hour
31. HOW TO RESET/DESTROY A COOKIE
Reset a cookie by specifying expiry time
Example: setcookie(”test”,$i,time()-3600); // already expired time
Reset a cookie by specifying its name only
setcookie(”test”);
32. WHAT IS THE DIFFERENCE BETWEEN EREG_REPLACE() AND EREGI_REPLACE()?
eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters
33. WHAT TYPES OF IMAGES THAT PHP SUPPORTS?
imagetypes — Return the image types supported by this PHP build
This function returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP. The following bits are returned, IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM. To check for PNG support, for example, do this: Example 1. imagetypes() example
34. CHECK IF A VARIABLE IS INTEGER IN JAVASCRIPT
var myValue =9.8;
if(parseInt(myValue)== myValue)
alert(’Integer’);
else
alert(’Not’);
35. TOOLS USED FOR DRAWING ER DIAGRAMS.
Case Studio
Smart Draw
No comments:
Post a Comment