It helps to checks if a value exists in an array.
if (in_array(“Mac”, $os)) {
echo “Got Mac”;
}
It helps to checks if a value exists in an array.
mysql_connect() Open a Connection to the MySQL Server.
Syntax : mysql_connect(servername,username,password);
// Check connection
if (mysqli_connect_errno())
{
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}
mysql_select_db() is using to select a MySQL database.
// Check connection
if (!$link) {
die(‘Not connected : ‘ . mysql_error());
}
// Select database
$db_selected = mysql_select_db(‘database_name’, $link);
if (!$db_selected) {
die (‘Not Selected database’ . mysql_error());
}
Short for PHP Extension and Application Repository, PEAR is a framework and distribution system for reusable PHP components. It is a structured library of open-source code for PHP users. It following a system for code distribution and package maintenance and a standard style for code written … Read more
strpos() helps to find the position of the first occurrence of a substring in a string.
Output : 15… Read more
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 … Read more
unlink() is using tp delete the given file from the file system.
$fh = fopen(‘page.html’, ‘a’);
fwrite($fh, ‘< h1>Hello world!‘);
fclose($fh);
unlink(‘page.html’);
It helps to convert all applicable characters to HTML entities.
< ?php
$str = "A 'quote' is <b>bold</b>";
echo 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.… Read more
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.… Read more