This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// تعريف المتغير x | |
let x; | |
// إسناد قيمة للمتغير x | |
x = 5; | |
// طباعة المتغير x | |
console.log(x); | |
// إسناد قيمة للمتغير y | |
y = 5; | |
// تعريف المتغير x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// تعريف المتغير x | |
var x; | |
// إسناد قيمة للمتغير x | |
x = 5; | |
// طباعة المتغير x | |
console.log(x); | |
// إسناد قيمة للمتغير y | |
y = 5; | |
// تعريف المتغير x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x = 10; | |
// قيمة المتغير هنا ب10 | |
{ | |
let x = 2; | |
// اما قيمة المتغير هنا ب2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x = 0; | |
let x = 2; | |
console.log(x); | |
//سيحدث خطأ فى هذه الحالة | |
//SyntaxError: Identifier 'x' has already been declared |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x = 0; | |
var x = 2; | |
console.log(x); | |
// سيتم تنفيذ السطور بشكل سليم |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// الملف الحالى على سبيل المثال script.php | |
echo $_SERVER['PHP_SELF']; | |
echo "<br>"; | |
// اسم السيرفر على سبيل المثال www.motwr.com | |
echo $_SERVER['SERVER_NAME']; | |
echo "<br>"; | |
// الهوست من طلب HTTP | |
echo $_SERVER['HTTP_HOST']; | |
echo "<br>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function test() { | |
$foo = "local variable"; | |
echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; | |
echo '$foo in current scope: ' . $foo . "\n"; | |
} | |
$foo = "Example content"; | |
test(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// by value الحالة العادية | |
function addFive($num) { | |
$num += 5; | |
} | |
// by reference حالة تمرير المعاملات | |
function addSix(&$num) { | |
$num += 6; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sum(int $x, int $y) { | |
$z = $x + $y; | |
return $z; | |
} | |
$sum = sum( 5, 10 ); | |
echo "Sum is " . $sum; | |
echo "Sum + 10 is " . ( $sum + 10 ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function setHeight(int $minheight = 50) { | |
echo "The height is : $minheight <br>"; | |
} | |
setHeight(350); | |
setHeight(); // سيتم إعتبار القيمة الإفتراضية وهى 50 | |
?> |