Friday, 22 April 2011

External Links In PHP

External Links

Include: by using this concept we can include a php script in another php script. Once we include the php script we can access the executable statements, functions, variables, consistence, and classes.
*Include embeds external script in the current executable script. We can embed the external script multiple times. If the external link is not available this function retuns a warning massage and executes the statement.
echo "frompage1";
include "page2.php";
echo $x;
echo $x;
echo constant ("city");
*save this file in htdocs as “page1.php”

echo "page2";
define ("city","hyd");
function fun1()
echo "from page2";
*save this file as “page2.php” and open the browser and type http://localhost/page1.php
Include_once: By using this function we can embed the external file only one time.
Require: This function embeds external file multiple times. If the external file in not available it returns fatal error and stops the execution of the script.

Require_once: It is same as require but, it can embed the external links only one time.


  1. Dear Sir, I am sai chowdhary i have completed my php courese 9am to 7am Batch. Give me some good suggestion for future. I m looking for a job as a fresher U can send me any query to Thanking You sai

  2. sir good evening this is karunakar ,present jquery class run any batch please give information