Login form



PHP. Functions and scope of view, PART 1
http://www.w3schools.com/PHP/php_functions.asp

Function doesnt return value, it will print text:
<?

function a (){
echo "Labas";
}

a();
a();
$a = a(); // text is printed 3rd time, but function doesnt return value
echo $a ; // nothing

?>

Function returns value, it will print text:
<?

function a (){
echo "Labas";
return "5";
}

a();
a();
$a = a(); // value of variable 5.
echo $a ; // it will print 5

?>

Function with parameter:
<?

function a ($f){
$e = "Labas " . $f;
return $e;
}

$a = a("rytas");
echo $a ; // atspausdins "Labas rytas"

?>

Bad declaration:
<?
function f_1 ()
{
return "Labas" ;
}

$a = f_1;
echo $a ; // it will print f_1

?>

More:

<?

function aaa ($a){
$b=$a*10;
return $b;
}

$c=aaa(10);
$d=aaa($c);

?>


Default parameter values:
<?

function xxxx ($h="nera"){
echo "rezultatas: $h <br>";
}
xxxx();
xxxx("geras");

?>

Few parameters:
<?

function uuu ($h="nera",$j){
echo "rezultatas: $h , $j<br>";
}
uuu("geras","irgi geras");
uuu("geras");
@uuu("be komentaru Warnings");

?>


<?

function dde($j,$h="nera"){
echo "rezultatas: $j , $h <br>";
}
dde("geras");

?>


 
[ BBC news ][ Yahoo news ][ Linux guru ][ Webmaster ACE ]