Example #1
0
//  so we add the function in to variable and then print the variable
$new_var = third("everybody");
echo $new_var;
?>
    <br />

    <p>function with return array </p>
    <?php 
function fourth($var)
{
    $plas = $var + 2;
    $minus = $var - 2;
    $arr = array($var, $plas, $minus);
    return $arr;
}
$new_var = fourth("7");
echo $new_var[0] . "<br />";
echo $new_var[1] . "<br />";
?>
    <p>function with global </p>
    <?php 
// get the var in to the function
$var4 = "string";
function fifth()
{
    global $var4;
    echo $var4;
}
fifth();
echo "<br>";
function six()
Example #2
0
<?php

// install.php :: creates/populates database tables on a new installation.
include 'lib.php';
$link = opendb();
$start = getmicrotime();
if (isset($_GET["page"])) {
    $page = $_GET["page"];
    if ($page == 2) {
        second();
    } elseif ($page == 3) {
        third();
    } elseif ($page == 4) {
        fourth();
    } elseif ($page == 5) {
        fifth();
    } else {
        first();
    }
} else {
    first();
}
// Thanks to Predrag Supurovic from php.net for this function!
function dobatch($p_query)
{
    $query_split = preg_split("/[;]+/", $p_query);
    foreach ($query_split as $command_line) {
        $command_line = trim($command_line);
        if ($command_line != '') {
            $query_result = mysql_query($command_line);
            if ($query_result == 0) {