function myFunction($parameter1, $parameter2) {
// this function's code goes here
return $returnValue; // the value returned
}
`<?php` then a `?>` and also `<?=` and `?>` are the only compliant methods now that PHP 7 is out.
// For single line comments /* Your comments here */ For multi-line comments
Each statement is ended with a semicolon. PHP is derived from C, so a lot of the components are very similar, including this. Google doesn't seem to care about these but for user's sake, for the sake of community and as a good practice, it is best to redirect and redirection should be 301.
The standard way to open a block of PHP (escaping it from HTML) is with the
1
function function_name() { .................... }
To rename a file in PHP the easiest way to do it is to use the rename() function. <?php rename("before.txt", "after.html"); ?>
The simplest way (the old procedural way) is to just declare the function: function ourSimpleFunction(){ //Function Guts } Functions do not require a return type, or typed arguments in PHP, however you can use type-hinting if it makes you feel better.
<?php include_once('<path_to_file>/time.inc'); ?>
`<?php` then a `?>` and also `<?=` and `?>` are the only compliant methods now that PHP 7 is out.
echo("hello world");
<?php include_once('<path_to_file>/time.inc'); ?>
PHP has built-in one way hashing using the md5 function. Additional encryption capabilities are available using the Mcrypt extension.
// For single line comments /* Your comments here */ For multi-line comments
We can write php extension is many way... .php , .php5, .php4
The serialize() function is used to create a storable representation of a variable in PHP.To store an array to a file, you first use the serialize() function to change an array into a string. Save the string in a file using file I/O, so fwrite() or a similar function. When reading it use unserialize() to get the original array again.
The easiest way is to create a file with a name ending in .php (such as info.php), containing only these 3 lines: <? phpinfo(); ?> Upload this file to your web space and access it using your browser. It will show a lot of information about your webserver and the php version running on it.