New Assignments for Php Part 2

14.How can we display information of a variable and readable by human with PHP? To be able to display a human-readable result we use print_r().
15.How is it possible to set an infinite execution time for PHP script?
The set_time_limit(0) added at the beginning of a script sets to infinite the time of execution to not have
the PHP error ‘maximum execution time exceeded’.
It is also possible to specify this in the php.ini file.
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal
error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in
the php.ini.When called, set_time_limit() restarts the timeout counter from zero. In other words,
if the timeout is the default 30 seconds, and 25 seconds into script execution a call such
as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.
16.What does the PHP error ‘Parse error in PHP – unexpected T_variable at
line x’ means?
This is a PHP syntax error expressing that a mistake at the line x stops parsing and executing the
program.
17.How can we check the value of a given variable is a number?
It is possible to use the dedicated function, is_numeric() to check whether it is a number or not.
18.How can we check the value of a given variable is alphanumeric?
It is possible to use the dedicated function, ctype_alnum to check whether it is an alphanumeric value or
not.
19.How do I check if a given variable is empty?
If we want to check whether a variable has a value or not, it is possible to use the empty() function.
20.What does the unlink() function means?
The unlink() function is dedicated for file system handling. It simply deletes the file given as entry.
21.What does the unset() function means?
The unset() function is dedicated for variable management. It will make a variable undefined.
22.How a constant is defined in a PHP script?
The define() directive lets us defining a constant as follows:define (“ACONSTANT”, 123);
23.How can you pass a variable by reference?
To be able to pass a variable by reference, we use an ampersand in front of it, as follows $var1 = &$var2
24.Will a comparison of an integer 12 and a string “13″ work in PHP?
“13″ and 12 can be compared in PHP since it casts everything to the integer type.
25.How is it possible to cast types in PHP?
The name of the output type have to be specified in parentheses before the variable which is to be cast
as follows:* (int), (integer) – cast to integer* (bool), (boolean) – cast to boolean* (float), (double), (real) – cast to float* (string) – cast to string* (array) – cast to array* (object) – cast to object Example:-$i=(float)$j //before cating $i is float and $j is int
26.How is the ternary conditional operator used in PHP?
It is composed of three expressions: a condition, and two operands describing what instruction should be
performed when the specified condition is true or false as follows:
Expression_1 ? Expression_2 : Expression_3;
27.What is the function func_num_args() used for?
The function func_num_args() is used to give the number of parameters passed into a function.
28.If the variable $var1 is set to 10 and the $var2 is set to the character var1, what’s the value of $$var2? $$var2 contains the value 10. 29.What does $GLOBALS means?
$GLOBALS is associative array including references to all variables which are currently defined in the
global scope of the script.30.what the difference between the ‘BITWISE AND’ operator and the ‘LOGICAL AND’ operator?AND operation: & -> will do the bitwise AND operation , it just doing operation based on the bit values.
&& -> It will do logical AND operation. It is just the check the values is true or false. Based on the boolean value , it will evaluation the expression 31.What are the two main string operators?The first is the concatenation operator (‘.’), which returns the concatenation of its right and left arguments. The second is (‘.=’), which appends the argument on the right to the argument on the left.32.What does the array operator ‘===’ means?$a === $b TRUE if $a and $b have the same key/value pairs in the same order and of the same types.33.What is the differences between $a != $b and $a !== $b?!= means inequality (TRUE if $a is not equal to $b) and !== meansnon-identity (TRUE if $a is not identical to $b).34.How can we determine whether a variable is set?
The boolean function isset determines if a variable is set and is not NULL.35.What is the difference between the functions strstr() and stristr()?The string function strstr(string allString, string occ) returns part of allString from the first occurrence of occ to the end of allString. This function is case-sensitive. stristr() is
identical to strstr() except that it is case insensitive.36.what is the difference between for and foreach?
for is expressed as follows:for (expr1; expr2; expr3)statement The first expression is executed once at the beginning. In each iteration, expr2 is evaluated. If it is TRUE, the loop continues and the statements inside for are executed. If it evaluates to FALSE, the execution of the loop ends. expr3 is tested at the end of each iteration.However, foreach provides an easy way to iterate over arrays and it is only used with arrays and objects.
foreach (array_expression as $value) statement foreach (array_expression as $key => $value)statement

rape porn

Admin has written 171 articles