कंप्यूटर प्रोग्रामिंग/वेरिएबल/पीएचपी
(कंप्यूटर प्रोग्रामिंग/चर/पीएचपी से अनुप्रेषित)
variables.php
सम्पादन<?php
echo "Variables and Data Types\n";
$i = 12345;
$f = 1.23456789012345;
$s = "string";
echo "int: $i\n";
echo "float: $f\n";
echo "string: $s\n";
echo "\n";
echo "Constants\n";
define("PI", 3.14159);
define("C", "Constant");
echo PI . " " . C;
echo "\n";
echo "Arithmetic Operators\n";
$a = 3;
$b = 2;
echo "a = $a\n";
echo "b = $b\n";
echo "a + b = " . ($a + $b) . "\n";
echo "a - b = " . ($a - $b) . "\n";
echo "a * b = " . ($a * $b) . "\n";
echo "a / b = " . ($a / $b) . "\n";
echo "\n";
echo "Assignment Operators\n";
$a += $b;
echo "a += b is $a\n";
$a -= $b;
echo "a -= b is $a\n";
$a *= $b;
echo "a *= b is $a\n";
$a /= $b;
echo "a /= b is $a\n";
echo "\n";
echo "String Concatenation\n";
$s1 = "Hello";
$s2 = "world";
echo $s1 . " " . $s2 . "!\n";
echo "\n";
echo "User Input\n";
$name = readline ("What is your name? ");
echo "Hello $name!\n";
?>
कोशिश करो
सम्पादननिम्न कोड मुफ्त ऑनलाइन विकास के वातावरण में से एक में ऊपर कॉपी और पेस्ट करो या अपने खुद के कम्पाइलर/इंटरप्रेटर/आईडीई का उपयोग करें।