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.
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
Post a Comment