Skip to content

Instantly share code, notes, and snippets.

View rasoulvatanparast's full-sized avatar

Rasoul Vatanparast rasoulvatanparast

View GitHub Profile
<?php
$n = 11;
if ($n != 10) {
echo "the number is not 10";
}
<?php
$n = 10;
if ($n == 10) {
echo "the number is 10";
}
<?php
function mul($x, $y){
return $x * $y;
}
echo mul(8, 8);
<?php
function info(){
return "this is the return value..";
}
echo info();
<?php
function info($name = "no name", $family = "no family name", $age = "0"){
echo "hi my name is: $name $family and I'm $age";
}
info("Rasoul", "Vatanparast", 22);
echo "<br />";
info();
<?php
function login($username, $pass){
if($pass == 1234 && $username == "rasoul"){
echo "login successful";
}else{
echo "invalid username or password";
}
}
<?php
function nameOfFunction(){
echo "this is a function...";
}
<?php
function nameOfFunction(){
echo "this is a function...";
}
nameOfFunction();
<?php
$x = 10;
$y = 15;
function test(){
$GLOBALS['x'] = $GLOBALS['x'] + $GLOBALS['y'];
}
<?php
$x = 10;
$y = 15;
function test(){
global $x, $y;
$x = $x * $y;
}