strpos() helps to find the position of the first occurrence of a substring in a string.
Output : 15
PHP is an important part of the web world, and every web developer should have the basic knowledge in PHP. Common PHP questions, which should help you become a best PHP developer.
strpos() helps to find the position of the first occurrence of a substring in a string.
Output : 15
SQL injection is a code injection technique and it is using to attack data driven applications, in which malicious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker). SQL injection must exploit a security vulnerability in an application’s software, for example, when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and unexpectedly executed. SQL injection is mostly known as an attack vector for websites but can be used to attack any type of SQL database.
Please refer this URL : http://en.wikipedia.org/wiki/SQL_injection
unlink() is using tp delete the given file from the file system.
$fh = fopen(‘page.html’, ‘a’);
fwrite($fh, ‘< h1>Hello world! h1>‘);
fclose($fh);
unlink(‘page.html’);
It helps to convert all applicable characters to HTML entities.
htmlentities($str);
// Outputs: A ‘quote’ is < ;b> ;bold< ;/b> ;
echo htmlentities($str, ENT_QUOTES);
// Outputs: A & #039 ;quote& #039 ; is < ;b> ;bold< ;/b> ; (ENT_QUOTES Will convert both double and single quotes.)
?>
MD5 is a hashing algorithm, you can not revert the hash value.
In PHP , both are variables. But $var is a variable with a fixed name. $$var is a variable who’s name is stored in $var. For example, if $var contains “user”, $$var is the same as $user.
ksort() id using to sort an array by key in reverse order.
$fruits = array(“d”=>”lemon”, “a”=>”orange”, “b”=>”banana”, “c”=>”apple”);
ksort($fruits);
foreach ($fruits as $key => $val) {
echo “$key = $val\n”;
}
Output :
a = orange
b = banana
c = apple
d = lemon
Answer : 3
Key value of ‘true’ will act as 1. So it wil replace the array value from 1 to 3