> Online tutorial : include_once in php
Showing posts with label include_once in php. Show all posts
Showing posts with label include_once in php. Show all posts

include_once in php

The include_once()statement include and evaluates the specified file during of execution of the script.This is a behavior similar to the include() function with the only difference being that it code from a file has already been included.It will not be included again.

Syntax
include "function name";
Example
vars.php


<?php
$color='red';
$fruit='apple';
echo $fruit."color is".$color"
?>
test.php

<?php
echo "a $color $fruit"
// include 'vars.php
include_once'vars.php'
echo "a $color $fruit"
?>
Output: