YouTube Icon

Interview Questions.

Top 100+ Php Interview Questions And Answers - Jun 01, 2020

fluid

Top 100+ Php Interview Questions And Answers

Question 1. What's Php?

Answer :

The PHP Hypertext Preprocessor is a programming language that permits web builders to create dynamic content material that interacts with databases. PHP is essentially used for growing internet primarily based software program applications.

Question 2. What Is A Session?

Answer :

A consultation is a logical item created by the PHP engine to can help you keep information throughout next HTTP requests.

There is handiest one session object to be had in your PHP scripts at any time. Data saved to the consultation with the aid of a script can be retrieved with the aid of the same script or any other script while requested from the equal vacationer.

Sessions are normally used to shop brief data to allow more than one PHP pages to provide a entire functional transaction for the identical visitor.

MySQL Interview Questions
Question three. What Is Meant By Pear In Php?

Answer :

PEAR is the subsequent 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 set up by bringing an automated wizard, and packing the energy and revel in of PHP customers right into a well organised OOP library. PEAR additionally offers a command-line interface that may be used to robotically set up "applications".

Question four. How Can We Know The Number Of Days Between Two Given Dates Using Php?

Answer :

Simple mathematics:
$date1 = date('Y-m-d');
$date2 = '2006-07-01';
$days = (strtotime() - strtotime()) / (60 * 60 * 24);
echo "Number of days considering that '2006-07-01': $days";

PHP Tutorial
Question 5. How Can We Repair A Mysql Table?

Answer :

The syntex for repairing a mysql table is:

REPAIR TABLE tablename
REPAIR TABLE tablename QUICK
REPAIR TABLE tablename EXTENDED

This command will restore the desk exact.
If QUICK is given, MySQL will do a repair of most effective the index tree.
If EXTENDED is given, it's going to create index row by using row.

PHP+MySQL Interview Questions
Question 6. What Is The Difference Between $message And $$message?

Answer :

$message is a easy variable while $$message is a variable's variable,which means
value of the variable. Example:
$consumer = 'bob'

is equal to

$message = 'consumer';
$$message = 'bob';

Question 7. What Is A Persistent Cookie?

Answer :

A continual cookie is a cookie that is stored in a cookie record permanently at the browser's pc. By default, cookies are created as brief cookies which saved simplest in the browser's reminiscence. When the browser is closed, temporary cookies may be erased. You ought to decide whilst to use temporary cookies and whilst to use chronic cookies based on their differences:

· Temporary cookies can not be used for tracking lengthy-time period data.
· Persistent cookies can be used for tracking lengthy-term records.
· Temporary cookies are safer because no programs apart from the browser can get admission to them.
· Persistent cookies are much less secure due to the fact customers can open cookie documents see the cookie values.

MySQL Tutorial Drupal Interview Questions
Question 8. How Do You Define A Constant?

Answer :

Via define() directive, like outline ("MYCONSTANT", a hundred);

Question 9. What Are The Differences Between Require And Include, Include_once?

Answer :

require_once() and include_once() are both the features to encompass and compare the required document simplest once. If the required file is blanketed previous to the existing call prevalence, it'll not be performed again.

But require() and include() will do it as typically they're asked to do.

MYSQL DBA Interview Questions
Question 10. What Is Meant By Urlencode And Urldecode?

Answer :

urlencode() returns the URL encoded version of the given string. URL coding converts special characters into % symptoms accompanied by using  hex digits. For instance: urlencode("10.00%") will return "10%2E00percent25". URL encoded strings are secure to be used as part of URLs.
Urldecode() returns the URL decoded model of the given string.

Drupal Tutorial
Question eleven. How To Get The Uploaded File Information In The Receiving Script?

Answer :

Once the Web server obtained the uploaded report, it'll call the PHP script distinct in the shape movement characteristic to method them. This receiving PHP script can get the uploaded file statistics via the predefined array referred to as $_FILES. Uploaded file information is prepared in $_FILES as a two-dimensional array as:

$_FILES[$fieldName]['name'] - The Original report name at the browser system.
 $_FILES[$fieldName]['type'] - The report kind decided by way of the browser.
 $_FILES[$fieldName]['size'] - The Number of bytes of the report content material.
 $_FILES[$fieldName]['tmp_name'] - The transient filename of the report wherein
the uploaded record changed into saved at the server.
 $_FILES[$fieldName]['error'] - The blunders code associated with this report upload.
The $fieldName is the name used inside the 
.
PHP5 Interview Questions
Question 12. What Is The Difference Between Mysql_fetch_object And Mysql_fetch_array?

Answer :

MySQL fetch object will acquire first single matching file where mysql_fetch_array will gather all matching information from the table in an array.

MySQL Interview Questions
Question thirteen. How Can I Execute A Php Script Using Command Line?

Answer :

Just run the PHP CLI (Command Line Interface) program and offer the PHP script document call because the command line argument. For example, "personal home page myScript.Personal home page", assuming "Hypertext Preprocessor" is the command to invoke the CLI application.
Be aware that in case your PHP script became written for the Web CGI interface, it could not execute nicely in command line surroundings.

WordPress Tutorial
Question 14. I Am Trying To Assign A Variable The Value Of 0123, But It Keeps Coming Up With A Different Number, What's The Problem?

Answer :

PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for extra numeric issues.

Question 15. Would I Use Print "$a Dollars" Or "$a Dollars" To Print Out The Amount Of Dollars In This Example?

Answer :

In this example it wouldn’t remember, because the variable is all with the aid of itself, but in case you have been to print something like "$a,000,000 mln greenbacks", then you definitely certainly need to use the braces.

WordPress Interview Questions
Question 16. 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))?

Answer :

Total five styles of tables we will create
1. MyISAM
2. Heap
three. Merge
4. INNO DB
5. ISAM
MyISAM is the default storage engine as of MySQL three.23. When you fireplace the above
create question MySQL will create a MyISAM desk.

Joomla Tutorial
Question 17. How To Create A Table?

Answer :

If you want to create a desk, you can run the CREATE TABLE announcement as shown in the following sample script:

<?Php
include "mysql_connection.Php";
$sql = "CREATE TABLE fyi_links ("
. " id INTEGER NOT NULL"
. ", url VARCHAR(80) NOT NULL"
. ", notes VARCHAR(1024)"
. ", counts INTEGER"
. ", time TIMESTAMP DEFAULT sysdate()"
. ")";
if (mysql_query($sql, $con)) 
print("Table fyi_links created.N");
 else 
print("Table creation failed.N");

mysql_close($con);
?>
Remember that mysql_query() returns TRUE/FALSE on CREATE statements. If you run this script, you will get some thing like this:
Table fyi_links created.

Joomla Interview Questions
Question 18. How Can We Encrypt The Username And Password Using Php?

Answer :

You can encrypt a password with the following Mysql>SET
PASSWORD=PASSWORD("Password");

PHP+MySQL Interview Questions
Question 19. How Do You Pass A Variable By Value?

Answer :

Just like in C++, put an ampersand in the front of it, like $a = &$b.

CakePHP Tutorial
Question 20. What Is The Functionality Of The Functions Strstr() And Stristr()?

Answer :

string strstr ( string haystack, string needle ) returns a part of haystack string from the first occurrence of needle to the cease of haystack. This characteristic is case-touchy.
Stristr() is idential to strstr() except that it's miles case insensitive.

CakePHP Interview Questions
Question 21. When Are You Supposed To Use Endif To End The Conditional Statement?

Answer :

When the unique if was accompanied via : after which the code block without braces.

Question 22. How Can We Send Mail Using Javascript?

Answer :

No. There is not any manner to ship emails directly the usage of JavaScript.
But you may use JavaScript to execute a client side e mail program ship the email the usage of the "mailto" code. Here is an example:
feature myfunction(shape)

tdata=document.Myform.Tbox1.Value;
place="mailto:mailid@area.Com?Concern=...";
go back actual;


CodeIgniter Tutorial
Question 23. What Is The Functionality Of The Function Strstr And Stristr?

Answer :

strstr() returns a part of a given string from the first incidence of a given substring to the quit of the string. For example: strstr("person@instance.Com","@") will go back "@instance.Com".
Stristr() is idential to strstr() except that it is case insensitive.

CodeIgniter Interview Questions
Question 24. What Is The Difference Between Ereg_replace() And Eregi_replace()?

Answer :

eregi_replace() function is equal to ereg_replace() except that it ignores case difference whilst matching alphabetic characters.

Drupal Interview Questions
Question 25. How Do I Find Out The Number Of Parameters Passed Into Function9?

Answer :

func_num_args() characteristic returns the range of parameters exceeded in.

PHP7 Tutorial
Question 26. What Is The Purpose Of The Following Files Having Extensions: Frm, Myd, And Myi? What These Files Contain?

Answer :

In MySQL, the default desk kind is MyISAM.
Each MyISAM desk is stored on disk in three documents. The files have names that begin with
the table call and feature an extension to indicate the file type.

The '.Frm' file stores the table definition.
The information document has a '.MYD' (MYData) extension.
The index record has a '.MYI' (MYIndex) extension.

PHP7 Interview Questions
Question 27. If The Variable $a Is Equal To 5 And Variable $b Is Equal To Character A, What's The Value Of $$b?

Answer :

five, it’s a connection with current variable.

MYSQL DBA Interview Questions
Question 28. How To Protect Special Characters In Query String?

Answer :

If you want to include unique characters like spaces in the query string, you want to guard them via making use of the urlencode() translation feature. The script underneath shows how to use urlencode():

<?Hypertext Preprocessor
print("<html>");
print("<p>Please click the hyperlinks underneath"
." to publish remarks about FYICenter.Com:</p>");
$remark = 'I need to mention: "It's a good web page! :->"';
$comment = urlencode($remark);
print("<p>"
."<a href="processing_forms.Php?Name=Guest&comment=$comment">"
."It's an extremely good web page!</a></p>");
$comment = 'This vacationer said: "It's a mean website! :-("';
$comment = urlencode($remark);
print("<p>"
.'<a href="processing_forms.Php?'.$comment.'">'
."It's a mean website.</a></p>");
print("</html>");
?>

Question 29. Are Objects Passed By Value Or By Reference?

Answer :

Everything is passed by fee.

Question 30. What Are The Differences Between Drop A Table And Truncate A Table?

Answer :

DROP TABLE table_name - This will delete the table and its facts.

TRUNCATE TABLE table_name - This will delete the data of the table, but no longer the table definition.

Question 31. What Are The Differences Between Get And Post Methods In Form Submitting, Give The Case Where We Can Use Get And We Can Use Post Methods?

Answer :

When you need to ship quick or small statistics, no longer containing ASCII characters, then you may use GET” Method. But for lengthy information sending, say extra then one hundred man or woman you may use POST method.

Once most critical difference is whilst you are sending the shape with GET method. You can see the output that you are sending in the cope with bar. Whereas in case you ship the shape with POST” method then user can't see that records.

Question 32. How Do You Call A Constructor For A Parent Class?

Answer :

parent::constructor($value).

Question 33. What Are The Different Types Of Errors In Php?

Answer :

Here are 3 primary forms of runtime mistakes in PHP:

Notices: These are trivial, non-important errors that PHP encounters whilst executing a script - for instance, accessing a variable that has now not yet been defined. By default, such errors aren't displayed to the consumer at all - although you can exchange this default behavior.
Warnings: These are greater extreme errors - as an instance, trying to encompass() a report which does now not exist. By default, these errors are exhibited to the user, however they do now not bring about script termination.
Fatal mistakes: These are important mistakes - as an example, instantiating an item of a nonexistent elegance, or calling a non-existent characteristic. These mistakes motive the immediate termination of the script, and PHP's default conduct is to display them to the user once they take location.
Internally, those variations are represented via twelve specific errors types.

PHP5 Interview Questions
Question 34. What's The Special Meaning Of __sleep And __wakeup?

Answer :

__sleep returns the array of all of the variables than need to be saved, even as __wakeup retrieves them.

Question 35. How Can We Submit A Form Without A Submit Button?

Answer :

If you don't want to apply the Submit button to put up a shape, you may use regular hyper links to put up a shape. But you need to use some JavaScript code within the URL of the hyperlink. For example:
<a href="javascript: document.Myform.Submit();">Submit Me</a>.

Question 36. Would You Initialize Your Strings With Single Quotes Or Double Quotes?

Answer :

Since the facts in the unmarried-quoted string isn't parsed for variable substitution, it’s always a better concept pace-sensible to initialize a string with single rates, until you specifically need variable substitution.

WordPress Interview Questions
Question 37. What Is The Difference Between The Functions Unlink And Unset?

Answer :

unlink() is a function for report machine dealing with. It will absolutely delete the record in context.

Unset() is a characteristic for variable management. It will make a variable undefined.

Question 38. How Come The Code Works, But Doesn't For Two-dimensional Array Of Mine?

Answer :

Any time you've got an array with more than one dimension, complex parsing syntax is required. Print "Contents: $arr[1][2]" would’ve labored.

Question 39. How Can We Register The Variables Into A Session?

Answer :

session_register($session_var);
$_SESSION['var'] = 'price';

Question 40. What Is The Difference Between Characters 23 And x23?

Answer :

The first one is octal 23, the second one is hex 23.

Joomla Interview Questions
Question forty one. How Can We Submit Form Without A Submit Button?

Answer :

We can use a easy JavaScript code related to an event cause of any shape subject. In the JavaScript code, we can name the file.Form.Put up() function to post the shape. For instance: <input type=button value="Save" onClick="document.Form.Submit()">.

Question 42. How Can We Create A Database Using Php And Mysql?

Answer :

We can create MySQL database with the usage of mysql_create_db($databaseName) to create a database.

CakePHP Interview Questions
Question forty three. How Many Ways We Can Retrieve The Date In Result Set Of Mysql Using Php?

Answer :

As individual gadgets so unmarried document or as a fixed or arrays.

Question 44. How Many Ways Can We Get The Value Of Current Session Id?

Answer :

session_id() returns the session identity for the current consultation.

Question 45. Can We Use Include ("abc.Php") Two Times In A Php Page "makeit.Php"?

Answer :

Yes.

Question 46. What's The Difference Between Include And Require?

Answer :

It’s how they take care of failures. If the document isn't always located by using require(), it'll purpose a deadly blunders and halt the execution of the script. If the record isn't always determined through encompass(), a caution might be issued, but execution will hold.

Question 47. Explain The Ternary Conditional Operator In Php?

Answer :

Expression preceding the ? Is evaluated, if it’s true, then the expression preceding the : is accomplished, in any other case, the expression following : is completed.

Question forty eight. What's The Difference Between Htmlentities() And Htmlspecialchars()?

Answer :

htmlspecialchars best takes care of <, >, single quote ‘, double quote " and ampersand.
Htmlentities interprets all occurrences of individual sequences that have distinct which means in HTML.

Question 49. How To Store The Uploaded File To The Final Location?

Answer :

move_uploaded_file ( string filename, string destination)

This function exams to make certain that the record particular by using filename is a legitimate add document (which means that it was uploaded thru PHP's HTTP POST upload mechanism). If the report is valid, it is going to be moved to the filename given by way of destination.

If filename isn't always a legitimate upload document, then no movement will arise, and move_uploaded_file() will go back FALSE.

If filename is a legitimate upload record, but can not be moved for some reason, no action will occur, and move_uploaded_file() will go back FALSE. Additionally, a warning could be issued.

Question 50. What Is The Difference Between Reply-to And Return-course In The Headers Of A Mail Function?

Answer :

Reply-to : Reply-to is in which to transport the respond of the mail.

Return-course : Return route is while there may be a mail transport failure happens then wherein to transport the failure notification.

Question 51. So If Md5() Generates The Most Secure Hash, Why Would You Ever Use The Less Secure Crc32() And Sha1()?

Answer :

Crypto usage in PHP is simple, but that doesn’t mean it’s unfastened. First off, depending on the facts which you’re encrypting, you might have motives to shop a 32-bit price in the database in place of the a hundred and sixty-bit value to save on area. Second, the greater secure the crypto is, the longer is the computation time to supply the hash value. A excessive extent website online might be appreciably slowed down, if common md5() technology is needed.

Question fifty two. How Can We Destroy The Session, How Can We Unset The Variable Of A Session?

Answer :

session_unregister() - Unregister a worldwide variable from the modern-day session.

Session_unset() - Free all session variables.

Question 53. What Type Of Headers Have To Be Added In The Mail Function To Attach A File?

Answer :

$boundary = '--' . Md5( uniqid ( rand() ) );
$headers = "From: "Me"n";
$headers .= "MIME-Version: 1.0n";
$headers .= "Content-Type: multipart/combined; boundary="$boundary"";

Question 54. List Out Different Arguments In Php Header Function?

Answer :

void header ( string string [, bool update [, int http_response_code]]).

Question 55. What Are The Different Functions In Sorting An Array?

Answer :

Sorting functions in PHP:
asort()
arsort()
ksort()
krsort()
uksort()
sort()
natsort()
rsort()

Question fifty six. How Can We Know The Count / Number Of Elements Of An Array?

Answer :

2 methods:

sizeof($array) - This function is an alias of rely().
Remember($urarray) - This function returns the number of factors in an array. Interestingly in case you simply bypass a easy var in place of an array, rely() will go back 1.

Question fifty seven. How Many Ways I Can Redirect A Php Page?

Answer :

Here are the possible ways of php web page redirection.

1. Using Java script:
'; echo 'window.Area.Href="'.$filename.'";'; echo ''; echo ''; echo ''; echo '';  
redirect

2. Using php characteristic: header

 

Question 58. How Many Ways We Can Pass The Variable Through The Navigation Between The Pages?

Answer :

At least 3 ways:
1. Put the variable into consultation inside the first page, and get it back from consultation in the next web page.
2. Put the variable into cookie within the first web page, and get it lower back from the cookie in the next page.
Three. Put the variable into a hidden shape field, and get it returned from the shape in the next page.

Question fifty nine. What Is The Maximum Length Of A Table Name, A Database Name, Or A Field Name In Mysql?

Answer :

Database name: sixty four characters
Table call: sixty four characters
Column call: 64 characters

Question 60. How Many Values Can The Set Function Of Mysql Take?

Answer :

MySQL SET function can take 0 or greater values, however at the maximum it could take sixty four values.

Question 61. What Are The Other Commands To Know The Structure Of A Table Using Mysql Commands Except Explain Command?

Answer :

DESCRIBE table_name;

Question sixty two. How Can We Find The Number Of Rows In A Table Using Mysql?

Answer :

Use this for MySQL
SELECT COUNT(*) FROM table_name;

Question 63. What Changes I Have To Do In Php.Ini File For File Uploading?

Answer :

Make the following line uncomment like:
; Whether to allow HTTP file uploads.
File_uploads = On
; Temporary directory for HTTP uploaded files (will use machine default if no longer
; distinctive).
Upload_tmp_dir = C:apache2triadtemp
; Maximum allowed length for uploaded files.
Upload_max_filesize = 2M

Question 64. What's The Difference Between Md5(), Crc32() And Sha1() Crypto On Php?

Answer :

The main difference is the period of the hash generated. CRC32 is, obviously, 32 bits, whilst sha1() returns a 128 bit fee, and md5() returns a a hundred and sixty bit cost. This is important whilst averting collisions.

Question 65. How Can We Find The Number Of Rows In A Result Set Using Php?

Answer :

Here is how can you find the range of rows in a result set in PHP:

$result = mysql_query($any_valid_sql, $database_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows located";

Question 66. What Is The Default Session Time In Php And How Can I Change It?

Answer :

The default session time in Hypertext Preprocessor is until last of browser.

Question 67. How Many Ways We Can We Find The Current Date Using Mysql?

Answer :

SELECT CURDATE();
SELECT CURRENT_DATE();
SELECT CURTIME();
SELECT CURRENT_TIME();

Question sixty eight. How Many Ways We Can Give The Output To A Browser?

Answer :

HTML output
PHP, ASP, JSP, Servlet Function
Script Language output Function
Different Type of embedded Package to output to a browser.

Question 69. Please Give A Regular Expression (preferably Perl/preg Style), Which Can Be Used To Identify The Url From Within A Html Link Tag?

Answer :

Try this: /href="([^"]*)"/i.

Question 70. Give The Syntax Of Grant Commands?

Answer :

The prevalent syntax for GRANT is as following
GRANT [rights] on [database] TO [username@hostname] IDENTIFIED BY [password]

Now rights can be:
a) ALL privilages
b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE and so on.

We can grant rights on all databse with the aid of usingh *.* or a few specific database by way of database.* or a specific table with the aid of database.Table_name.

Question seventy one. What Are The Different Ways To Login To A Remote Server? Explain The Means, Advantages And Disadvantages?

Answer :

There is at least three approaches to logon to a far flung server:
Use ssh or telnet if you problem with security
You also can use rlogin to logon to a far off server.

Question seventy two. Give The Syntax Of Revoke Commands?

Answer :

The prevalent syntax for revoke is as following
REVOKE [rights] on [database] FROM [username@hostname]

Now rights may be:
a) ALL privilages
b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE and so forth.

We can provide rights on all databse through usingh *.* or some particular database via database.* or a specific table by way of database.Table_name.

Question seventy three. When Viewing An Html Page In A Browser, The Browser Often Keeps This Page In Its Cache. What Can Be Possible Advantages/risks Of Page Caching? How Can You Prevent Caching Of A Certain Page (please Give Several Alternate Solutions)?

Answer :

When you operate the metatag in the header phase at the start of an HTML Web page, the Web page might also nevertheless be cached inside the Temporary Internet Files folder.

A web page that Internet Explorer is surfing isn't always cached till 1/2 of the sixty four KB buffer is filled. Usually, metatags are inserted within the header segment of an HTML report, which appears at the beginning of the record. When the HTML code is parsed, it's miles study from pinnacle to backside. When the metatag is examine, Internet Explorer seems for the existence of the page in cache at that precise second. If it's miles there, it is removed. To nicely save you the Web page from performing inside the cache, vicinity another header section on the cease of the HTML report.

Question 74. When You Want To Show Some Part Of A Text Displayed On An Html Page In Red Font Color? What Different Possibilities Are There To Do This? What Are The Advantages/negative aspects Of These Methods?

Answer :

There are 2 methods to show some part of a text in red:

1. Using HTML tag <font color="red">
2. Using HTML tag </font>

Question 75. What Is The Difference Between Char And Varchar Data Types?

Answer :

CHAR is a set duration facts kind. CHAR(n) will take n characters of garage even in case you input less than n characters to that column. For instance, "Hello!" might be stored as "Hello! " in CHAR(10) column.

VARCHAR is a variable length records kind. VARCHAR(n) will take best the desired storage for the real quantity of characters entered to that column. For example, "Hello!" may be saved as "Hello!" in VARCHAR(10) column.

Question seventy six. How Can We Encrypt And Decrypt A Data Present In A Mysql Table Using Mysql?

Answer :

AES_ENCRYPT() and AES_DECRYPT().

Question 77. How Can We Change The Name Of A Column Of A Table?

Answer :

MySQL query to rename table: RENAME TABLE tbl_name TO new_tbl_name
or,
ALTER TABLE tableName CHANGE OldName newName.

Question seventy eight. How Can Increase The Performance Of Mysql Select Query?

Answer :

We can use LIMIT to prevent MySql for in addition search in desk after we've got acquired our required no. Of information, additionally we can use LEFT JOIN or RIGHT JOIN instead of complete join in instances we've associated facts in  or more tables.

Question 79. Will Comparison Of String "10" And Integer 11 Work In Php?

Answer :

Yes, internally PHP will forged the entirety to the integer kind, so numbers 10 and eleven could be compared.

Question 80. What Type Of Inheritance That Php Supports?

Answer :

In PHP an extended elegance is continually dependent on a single base class, this is, multiple inheritance isn't supported. Classes are prolonged using the key-word 'extends'.

Question eighty one. What Is The Functionality Of Md5 Function In Php?

Answer :

string md5(string)
It calculates the MD5 hash of a string. The hash is a 32-person hexadecimal range.

Question 82. How Can I Load Data From A Text File Into A Table?

Answer :

The MySQL provides a LOAD DATA INFILE command. You can load data from a document.
Great tool but you want to make sure that:

a) Data should be delimited.
B) Data fields need to fit desk columns efficaciously.

Question 83. How Can We Know The Number Of Days Between Two Given Dates Using Mysql?

Answer :

Use DATEDIFF()
SELECT DATEDIFF(NOW(),'2006-07-01');

Question 84. How Can We Change The Data Type Of A Column Of A Table?

Answer :

This will exchange the information type of a column:
ALTER TABLE table_name CHANGE colm_name same_colm_name [new data type].

Question eighty five. How Can We Know That A Session Is Started Or Not?

Answer :

A consultation starts offevolved via session_start() characteristic.
This session_start() is constantly declared in header element. It continually declares first. Then we write session_ sign in().

Question 86. What Are The Advantages And Disadvantages Of Cascade Style Sheets?

Answer :

External Style Sheets
Advantages
Can manipulate patterns for multiple documents immediately Classes may be created to be used on multiple HTML element kinds in lots of documents Selector and grouping methods may be used to apply patterns beneath complicated contexts

Disadvantages

An greater down load is needed to import style information for every report The rendering of the document may be not on time until the external style sheet is loaded Becomes slightly unwieldy for small quantities of style definitions

Embedded Style Sheets
Advantages
Classes can be created to be used on multiple tag sorts inside the file Selector and grouping techniques may be used to apply styles beneath complex contexts No extra downloads essential to acquire style information

Disadvantage

This technique can not manage patterns for more than one files right away

Inline Styles
Advantages
Useful for small quantities of style definitions Can override different fashion specification strategies at the neighborhood degree so best exceptions want to be listed along with other style strategies

Disadvantages

Does not distance style statistics from content (a chief goal of SGML/HTML) Can now not manage patterns for more than one files right now Author can't create or control training of elements to manipulate more than one detail sorts within the document Selector grouping strategies can not be used to create complicated element addressing eventualities

Question 87. If We Login More Than One Browser Windows At The Same Time With Same User And After That We Close One Window, Then Is The Session Is Exist To Other Windows Or Not? And If Yes Then Why? If No Then Why?

Answer :

Session depends on browser. If browser is closed then consultation is misplaced. The consultation data might be deleted after session day trip. If connection is lost and you recreate connection, then consultation will preserve within the browser.

Question 88. What's The Difference Between Accessing A Class Method Via -> And Via ::?

Answer :

:: is allowed to access techniques which could carry out static operations, i.E. The ones, which do no longer require item initialization.

Question 89. What Are The Mysql Database Files Stored In System ?

Answer :

Data is stored in call.Myd
Table shape is saved in name.Frm
Index is stored in name.Myi

Question ninety. Explain Normalization Concept?

Answer :

The normalization process includes getting our information to comply to three innovative regular forms, and a better level of normalization can not be finished until the preceding levels have been accomplished (there are surely 5 regular paperwork, however the remaining two are especially instructional and could not be mentioned).

First Normal Form
The First Normal Form (or 1NF) involves elimination of redundant data from horizontal rows. We need to make certain that there is no duplication of information in a given row, and that each column stores the least amount of facts feasible (making the sphere atomic).

Second Normal Form
Where the First Normal Form offers with redundancy of statistics across a horizontal row, Second Normal Form (or 2NF) deals with redundancy of data in vertical columns. As said earlier, the normal forms are revolutionary, so that you can acquire Second Normal Form, your tables ought to already be in First Normal Form.

Third Normal Form
I even have a confession to make; I do not frequently use Third Normal Form. In Third Normal Form we are seeking out facts in our tables that is not fully dependant at the number one key, however dependant on any other fee inside the table

Question ninety one. What Is The Difference Between Php4 And Php5?

Answer :

PHP4 can not help oops ideas and Zend engine 1 is used.
PHP5 supports oops ideas and Zend engine 2 is used.
Error helping is extended in PHP5.
XML and SQLLite will is multiplied in PHP5.

Question 92. What Are The Advantages Of Stored Procedures, Triggers, Indexes?

Answer :

A stored manner is a fixed of SQL instructions that can be compiled and saved in the server. Once this has been performed, customers don't need to keep re-issuing the whole question but can consult with the saved process. This affords higher basic overall performance due to the fact the question needs to be parsed best once, and less information needs to be despatched among the server and the consumer. You can also boost the conceptual level by having libraries of features within the server. However, saved tactics of direction do growth the load at the database server gadget, as greater of the paintings is finished on the server side and much less at the client (utility) side. Triggers will also be carried out. A trigger is efficaciously a form of saved system, one that is invoked whilst a selected occasion occurs. For instance, you could set up a saved process that is induced whenever a file is deleted from a transaction desk and that stored manner automatically deletes the corresponding client from a purchaser table when all his transactions are deleted.

Indexes are used to locate rows with precise column values fast. Without an index, MySQL need to start with the first row and then study thru the whole desk to find the applicable rows. The large the table, the greater this costs. If the desk has an index for the columns in query, MySQL can speedy decide the placement to searching for to within the center of the records report while not having to examine all the statistics. If a desk has 1,000 rows, this is at least a hundred times quicker than studying sequentially. If you want to get admission to most of the rows, it's far faster to read sequentially, due to the fact this minimizes disk seeks.

Question ninety three. What Are The Difference Between Abstract Class And Interface?

Answer :

Abstract class: summary lessons are the elegance wherein one or more methods are abstract however no longer always all technique needs to be summary. Abstract techniques are the strategies, which might be declare in its class however no longer outline. The definition of those methods need to be in its extending class.

Interface: Interfaces are one sort of elegance wherein all the techniques are abstract. That means all the techniques simplest declared but now not described. All the methods have to be outline by way of its carried out class

Question ninety four. Can We Use Include(abc.Php) Two Times In A Php Page Makeit.Php?

Answer :

Yes we can consist of that oftentimes we need, however right here are a few matters to make certain of: (along with abc.PHP, the record names are case-touchy) there should not be any replica function names, way there have to not be features or lessons or variables with the equal call in abc.PHP and makeit.Personal home page.

Question 95. How Can I Make A Script That Can Be Bilingual (helps English, German)?

Answer :

You can change char set variable in above line in the script to assist bi language.

Question ninety six. What Is The Maximum Size Of A File That Can Be Uploaded Using Php And How Can We Change This?

Answer :

You can alternate maximum size of a file set upload_max_filesize variable in Hypertext Preprocessor.Ini document.

Question ninety seven. How Can We Get Second Of The Current Time Using Date Function?

Answer :

$2nd = date("s");

Question ninety eight. 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 item with properties that correspond to the fetched row and actions the inner records pointer beforehand. Returns an item with properties that correspond to the fetched row, or FALSE if there are no greater rows.

Mysql_fetch_row() - Fetches one row of statistics from the result related to the desired end result identifier. The row is returned as an array. Each end result column is stored in an array offset, beginning at offset 0.

Question 99. What Are The Features And Advantages Of Object Oriented Programming?

Answer :

One of the main benefits of OO programming is its ease of amendment; items can effortlessly be changed and introduced to a gadget there by means of lowering renovation costs. OO programming is likewise considered to be better at modeling the actual global than is procedural programming. It permits for more complicated and flexible interactions. OO systems also are less difficult for non-technical personnel to recognize and less difficult for them to participate within the preservation and enhancement of a gadget as it appeals to natural human cognition patterns. For some systems, an OO method can speed improvement time considering that many items are general throughout structures and may be reused. Components that manipulate dates, transport, buying carts, and so forth. Can be purchased and without problems modified for a specific gadget.

Question 100. What Are The Reasons For Selecting Lamp (linux, Apache, Mysql, Php) Instead Of Combination Of Other Software Programs, Servers And Operating Systems?

Answer :

All of these are open source aid. Security of Linux may be very greater than home windows. Apache is a higher server that IIS both in functionality and security. Mysql is world most famous open source database. Php is extra quicker that asp or some other scripting language.

Question one hundred and one. What Is Meant By Nl2br()?

Answer :

nl2br() inserts a HTML tag
earlier than all new line characters n in a string.

Echo nl2br("god bless n you");

output:
god bless
you

Question 102. What Are The Current Versions Of Apache, Php, And Mysql?

Answer :

PHP: PHP 5.1.2
MySQL: MySQL 5.1
Apache: Apache 2.1

Question 103. How Can We Encrypt And Decrypt A Data Presented In A Table Using Mysql?

Answer :

You can use functions: AES_ENCRYPT() and AES_DECRYPT() like:

AES_ENCRYPT(str, key_str)
AES_DECRYPT(crypt_str, key_str)

Question 104. How Can We Destroy The Cookie?

Answer :

Set the cookie with a beyond expiration time.

Question one hundred and five. How Can I Retrieve Values From One Database Server And Store Them In Other Database Server Using Php?

Answer :

For this reason, you could first read the statistics from one server into consultation variables. Then connect with other server and truly insert the information into the database.

Question 106. How Can We Submit From Without A Submit Button?

Answer :

Trigger the JavaScript code on any event ( like onSelect of drop down listing field, onfocus, and so on ) file. Myform.Submit(); This will submit the form.

Question 107. Who Is The Father Of Php And What Is The Current Version Of Php And Mysql?

Answer :

Rasmus Lerdorf.
PHP five.1. Beta
MySQL 5.Zero

Question 108. Tools Used For Drawing Er Diagrams?

Answer :

Case Studio.
Smart Draw.

Question 109. In How Many Ways We Can Retrieve Data In The Result Set Of Mysql Using Php?

Answer :

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 end result row as an enumerated array

Question 110. What Are The Functions For Imap?

Answer :

imap_body - Read the message body
imap_check - Check cutting-edge mailbox
imap_delete - Mark a message for deletion from current mailbox
imap_mail - Send an e mail message

Question 111. Check If A Variable Is An Integer In Javascript ?

Answer :

var myValue =nine.8;
if(parseInt(myValue)== myValue)
alert('Integer');
else
alert('Not an integer');

Question 112. What Are Encryption Functions In Php?

Answer :

CRYPT()
MD5()

Question 113. What Types Of Images That Php Supports ?

Answer :

Using imagetypes() feature to discover what varieties of snap shots are supported to your PHP engine.

Imagetypes() - Returns the photograph types supported.

This function returns a bit-discipline similar to the photograph codecs supported with the aid of the version of GD connected into PHP. The following bits are back IMG_PNG a few special characters to HTML entities (Only the maximum broadly used)

htmlentities() - Convert ALL special characters to HTML entities.

Question a hundred and fifteen. How To Reset/destroy A Cookie ?

Answer :

Reset a cookie with the aid of specifying expire time inside the past:
Example: setcookie('Test',$i,time()-3600); // already expired time
Reset a cookie by using specifying its call handiest
Example: setcookie('Test');

Question 116. What Is The Functionality Of The Function Htmlentities?

Answer :

htmlentities() - Convert all applicable characters to HTML entities
This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML individual entity equivalents are translated into those entities.

Question 117. How Can We Get The Properties (size, Type, Width, Height) Of An Image Using Php Image Functions?

Answer :

To know the picture size use getimagesize() function
To understand the photograph width use imagesx() function
To recognize the photo top use imagesy() feature

Question 118. How To Set Cookies?

Answer :

setcookie('variable','fee','time')
;
variable - call of the cookie variable
value - price of the cookie variable
time - expiry time
Example:

setcookie('Test',$i,time()+3600);
Test - cookie variable call
$i - fee of the variable 'Test'
time()+3600 - denotes that the cookie will expire after an one hour.

Question 119. How Can We Increase The Execution Time Of A Php Script?

Answer :

By using void set_time_limit(int seconds) Set the range of seconds a script is permitted to run. If that is reached, the script returns a fatal mistakes. The default restrict is 30 seconds or, if it exists, the max_execution_time value defined inside the php.Ini. If seconds is set to zero, no time restriction is imposed.

When referred to as, set_time_limit() restarts the timeout counter from zero. In other phrases, if the timeout is the default 30 seconds, and 25 seconds into script execution a name which includes set_time_limit(20) is made, the script will run for a total of forty five seconds before timing out.

Question 120. In How Many Ways We Can Retrieve Data In The Result Set Of Mysql Using Php?

Answer :

mysql_fetch_array - Fetch a end result row as an associative array, a numeric array, or each.

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.

Question 121. Who Is The Father Of Php And What Is The Current Version Of Php And Mysql?

Answer :

Rasmus Lerdorf.
PHP five.1. Beta
MySQL 5.Zero

Question 122. What's The Difference Between Include And Require?

Answer :

It’s how they deal with screw ups. If the document is not determined by using require(), it'll reason a fatal blunders and halt the execution of the script. If the file is not located through include(), a warning will be issued, however execution will keep.

Question 123. Steps For The Payment Gateway Processing?

Answer :

An on line price gateway is the interface among your merchant account and your Web web site. The online price gateway allows you to straight away verify credit score card transactions and authorize budget on a patron’s credit card directly from your Web website. It then passes the transaction off in your merchant financial institution for processing, typically referred to as transaction batching.

Question 124. Can We Use Include(abc.Hypertext Preprocessor) Two Times In A Php Page Makeit.Personal home page?

Answer :

Yes we will encompass that many times we need, however right here are a few matters to make certain of: (such as abc.PHP, the report names are case-sensitive).
There should not be any reproduction feature names, means there must no longer be functions or instructions or variables with the equal name in abc.PHP and makeit.Personal home page.

Question a hundred twenty five. How Many Ways We Can Give The Output To A Browser?

Answer :

HTML output
PHP, ASP, JSP, Servlet Function
Script Language output Function
Different Type of embedded Package to output to a browser.

Question 126. What Are The Different Ways To Login To A Remote Server? Explain The Means, Advantages And Disadvantages?

Answer :

There is at the least three ways to logon to a faraway server:
Use ssh or telnet in case you challenge with security
You can also use rlogin to logon to a far flung server.

Question 127. What Is Meant By Mime?

Answer :

MIME is Multipurpose Internet Mail Extensions is an Internet wellknown for the format of email. However browsers also uses MIME widespread to transmit files. MIME has a header which is added to a beginning of the records. When browser sees such header it shows the records as it would be a document (as an instance picture) Some examples of MIME types:

audio/x-ms-wmp
photograph/png
software/x-shockwave-flash

Question 128. What Is The Difference Between Group By And Order By In Sql?

Answer :

To type a result, use an ORDER BY clause.
The most wellknown way to meet a GROUP BY clause is to test the entire table and create a brand new brief desk in which all rows from every group are consecutive, after which use this brief table to discover businesses and apply mixture capabilities (if any). ORDER BY [col1],[col2],...[coln]; Tells DBMS according to what columns it ought to sort the end result. If  rows will have the identical cost in col1 it will try to sort them according to col2 and so on.

GROUP BY [col1],[col2],...[coln]; Tells DBMS to group (mixture) results with same price of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you need to rely all items in organization, sum all values or view common.

Question 129. Who Is The Father Of Php And Explain The Changes In Php Versions?

Answer :

Rasmus Lerdorf is called the daddy of PHP.PHP/F1 2.Zero is an early and not supported model of PHP. PHP three is the successor to PHP/FI 2.Zero and is a lot nicer. PHP four is the cutting-edge era of PHP, which uses the Zend engine under the hood. PHP five makes use of Zend engine 2 which, amongst other matters, offers many additionalOOP functions .

Question one hundred thirty. Which Method Do You




CFG