Best Answer:- PHP is a server-side scripting language commonly used for creating dynamic web applications. PHP has their Code frameworks for example like(Laravel, Zend, CodeIgniter, Symphony, CakePHP) and Content Management Systems(WordPress, Drupal, Joomla) and ECommerce Platforms for Creating websites.
Best Answer:- They both include a specific file but on require the if the file can’t be included, a process will exit with a fatal error but in the same case in include statement may still pass and jump to the next step in the execution.
Best Answer:- unset() is used to destroy a variable whereas unlink() is used to destroy a file.
— GET displays the submitted data as part of the URL, during POST this information is not shown as it’s encoded in the request.
— GET can handle a maximum of 2048 characters, POST has no such restrictions.
— GET allows only ASCII data, POST has no restrictions, binary data are also allowed.
— GET is used to retrieve data where POST to insert and update.
Best Answer:- In php We can include a file using
require() function with file path as its parameter.
you can declare an array in php like in this way
var $arr = array('Php', 'java', 'ruby');
in_array used to checks if a value exists in an array
count() is used to count all elements in an array or something in an object.
Setcookie(“New_sample”, “ram”, time()+3600);
This PHP function breaks a string into an array.
$str = 'one,two,three,four';
// zero limit
// positive limit
// negative limit
The following code can be used for it,
strlen() function used to find the length of a string.
exit() function is used to stop the execution of a page.
Associative arrays are arrays that use string keys is called associative arrays.
you can create an associative array in this way
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
The date() function provides you to retrieve the current date and time.
It is used for sort an array by key in reverse order.
Both are the Variables, But $var is a variable with a fixed name. $$var is a variable whose name is stored in $var. For example, if $var contains “message”, $$var is the same as $message.
Unlink() deletes the given file from the file system.
Split function splits a string into array by regular expression while Explode splits a string into array by string.
if ($_FILES["file"]["error"] == 0)
"image_upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "image_upload/" . $_FILES["file"]["name"];
The trim() function is used for removes whitespaces or other predefined characters from both sides of a string.
Using define() directive, like for example
For Sending email using PHP, you can use the mail() function. mail() function accepts 5 parameters.
MD5 PHP implements the MD5 hash algorithm using the md5 function,
eg : $encrypted_text = md5 ($msg);
Generally we used the MD5 function to encrypt the password.
The rand() function in php is used for generate a random number. This function can generate numbers with-in a given range.
$_PHP_SELF variable is used for the PHP script name and suppose when you click “submit” button then same PHP script will be called inside your page.
$con = mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
echo "Failed to connect to MySQL: " . mysqli_connect_error();
— Outputs one or more strings separated by commas
— No return value
e.g. echo “String 1”, “String 2”
— Outputs only a single string
— Returns 1, so it can be used in an expression
e.g. print “Hello”
or, if ($expr && print “foo”)
— It Accepts strings and other types including arrays and objects, formatting them to be readable
Useful when debugging.
— for example you can directly pass the array to
print_r() function to see the values.