Skip to Content

You are here


Difference Between Include() Vs Include_once() In Php

The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. As the name suggests, it will be included just once.

ok, what does this mean exactly? lets say for example, i have three files, 






this is how each file looks like:


Nice Examples of XML and DOMDocument

Its all about the DOMDocument and generating the XML from the same with examples. I have created some of the good documents with the examples for generating the xml and formatting the same. You will get most of the functions with the examples are written in the following post :
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement('root');
echo $dom->saveXML();
1. Creating XML Document and Displaying :


Generating xml from text file

error_reporting(E_ALL); ini_set("display_errors", 1); $handle = @fopen("site_hierarchy.txt", "r"); if ($handle) { /** Creating the root element in the xml **/ $doc = new DOMDocument("1.0"); // Read File Line By Line $prevCount = -1; $prevNode = NULL; $prevNode = $doc->createElement("root"); $doc->appendChild($prevNode); while (($fileContent = fgets($handle, 4096)) !== false) { $count = 0; $newStrLine = $fileContent; $newStrLine = str_replace("\t","" , $newStrLine, $count); $child = createTerms($doc,$newStrLine); if ( $prevCount < $count ) { $prevNode = $prevNode->appendChild($ch


Moodle 1.9 Course completion not present

Hi, I have gone through one of the requirement stating that in



Subscribe to RSS - PHP