PHP maintains four direct functions for bringing in code from other files/sources.
require() and require_once() bring code in from another source and PHP will refuse to run if it cannot load those files.
include() and include_once() bring code in just the same, but your script will continue to run if those files could not be parsed. Thus you would use it if the code is optional and not necessary.
The _once() functions tell PHP to keep a list of required/included files so far and ignore the request if it's already been done somewhere else. Otherwise, it'll parse the file twice and could cause your script to fail because the functions, classes, etc defined during the second load would conflict with those loaded the first time.
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 ?>
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>
chdir() PHP function helps in changing the current directory.
It gets options from the command line argument list. It can be used in PHP 4.3 and above, including PHP 5.
header() is a php function used to modify and set HTTP headers sent to the browser.
in php used for one typ website
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() { .................... }
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>
chdir() PHP function helps in changing the current directory.
It gets options from the command line argument list. It can be used in PHP 4.3 and above, including PHP 5.
With a call to the function func_num_args().
header() is a php function used to modify and set HTTP headers sent to the browser.
To rename a file in PHP the easiest way to do it is to use the rename() function. <?php rename("before.txt", "after.html"); ?>
To include a file in PHP all you need to do is use the include() function as I have shown you in the example below. <?php include("filename.php"); ?>