Skip to main content

Openings for different technoogies.

PHP Interview Questions

1) What is the difference between strstr & stristr?

For strstr, the syntax is: string strstr(string $string,string $str ); The function strstr will search $str in $string. If
it finds the string means it will return string from where it finds the $str upto end of $string.
For Example:
$string = "http://yahoomail.com";
$str="yahoomail";
The output is "yahoomail.com". The main difference between strstr and stristr is of case sensitivity. The
former consider the case difference and later ignore the case difference.

2) What is the difference between explode and split?
Split function splits string into array by regular expression. Explode splits a string into array by string.
For Example:
explode(" and", "India and Pakistan and Srilanka");
split(" :", "India : Pakistan : Srilanka");
Both of these functions will return an array that contains India, Pakistan, and Srilanka.

3) How can you avoid execution time out error while fetching record from MySQL?
set_time_limit -- Limits the maximum execution time
For Example:
set_time_limit(0);
If you set to 0 you say that there is not limit.

4) Write a SQL query that displays the difference between the highest and lowest salaries of a database table
"employees". Label the column as DIFFERENCE.
Select max(sal)-min(sal) as Difference from employees;

5) What is the difference between require() and include()?

Both of these constructs includes and evaluates the specific file. The two functions are identical in every way
except how they handle failure. If filepath not found, require() terminates the program and gives fatal error,
but include() does not terminate the program; It gives warning message and continues to program.
include() produces a Warning while require() results in a Fatal Error if the filepath is not correct.

Comments

Popular posts from this blog

Openings for different technoogies.

 

What is the purpose of using the TIMESTAMP data type?

  A TIMESTAMP data type is used to store the combination of date and time value which is 19 characters long. The format of TIMESTAMP is YYYY-MM-DD HH:MM: SS. It can store data from ‘1970-01-01 00:00:01’ UTC to ‘2038-01-19 03:14:07’ UTC. By default, the current date and time of the server get inserted in the field of this data type when a new record is inserted or updated.

PHP History And Information

With an increasing community; PHP is considered today as one of the most famous scripting languages. It is widely used today as a general purpose scripting language, particularly useful for web developments and like other scripting languages; it can also be embedded directly into the HTML code. Within a short span of time, PHP has gained remarkable popularity and its community is increasing rapidly. There are various reasons for that, for instance: My security bunny found a more fortified position PHP, as you may know, is a free software and anyone can download it; use it and it supports various operating systems The syntax of PHP is quite similar to C which makes it more appealing for computer programmers. Whatever you have done with Perl in the past, you can do it with PHP. PHP is web specific and is more powerful than Perl. PHP works equally well and can be deployed on many web servers like Apache, IIS etc PHP scripts can be used for various standard network pro...