The function die() stops the script from running. See the example below:
<?php
die("this text will be outputted on the page");
echo "this text will not be shown due to the script ending when the die() function was called";
?>
in php used for one typ website
header() is a php function used to modify and set HTTP headers sent to the browser.
It gets options from the command line argument list. It can be used in PHP 4.3 and above, including PHP 5.
we cant use set timeout function in php because it is of java script function
Below is a simple example of how you could return a value in a PHP function. <?php function returnme($value) { return $value; } echo returnme('hello'); // outputs: hello ?>
function function_name() { .................... }
Flags in PHP are just a kind of constants. They map to a number and are used as optional function parameters. For instance in a file_put_contents() function there is a flag called FILE_APPEND, which appends the data to the file instead of overwriting it.
Please see this example as below. <?php $first_variable = "Heloooo"; function first_method(){ print 'Heloooo'; } class firstClass{ public $testvar=""; function firstClass(){ // initialize $this->testvar = "Hiiiiiii"; } function first_method_inclass(){ print 'Heloooo'; } } ?>
In PHP, the exit() function calls and end to the script in much the same way as when the end of the script is reached naturally. Objects are destructed, garbage cleaned, and everything is wrapped up nicely and neatly. This is as opposed to die(), which just stops the script where it is without allowing other final processes to complete.
The eval() function evaluates a string as PHP code. http://us.php.net/manual/en/function.eval.php
A simple function call <html> <body> <?php if(isset($_POST['button'])) { setValue(); // Function is called } function setValue() { echo "<br>The button property to call PHP function works"; // Your code here } ?> <input type="submit" name="button" onclick=<?php $_SERVER['PHP_SELF']; ?> /> </body> </head>
A PHP function is a block of reusable code that performs a specific task. Functions can accept input parameters and return a value, making them useful for organizing and simplifying code. They allow you to encapsulate logic and execute it whenever needed within a PHP program.