ទំព័រដែលថ្មីៗ

Wednesday, December 4, 2013

ការប្រើប្រាស់PHP

                          i.   PHP COMMENT
              COMMENT ប្រើសម្រាប់កំណត់សម្គាល់កូដ របស់យើងត្រង់ចំនុចណាមួយ ឬក៏ប្រើ សម្រាប់បិទ ត្រង់កូដណាមួយ ដែលយើងមិនចង់អោយវាដំណើរការ។កូដ comment: “//” ដោយដាក់សញ្ញានេះ នៅពីខាងមុខពាក្យ ឬកូដដែលយើងចង់បាន។
                       ii.   PHP SYNTAX
Syntax របស់ PHP មានទំរង់ផ្សេងគ្នា ដូចខាងក្រោម៖

ü  <?PHP STATEMENT ?>
Ex:1
Result
<?php
Echo ‘I love php language!’;
Echo “It is easy to learn!”;
?>
I love php language!
It is easy to learn!

Ex:2
Result
<script language=”php”>
Echo ‘I love php language!’;
Echo “It is easy to learn!”;
</script>

I love php language!
It is easy to learn!



នៅក្នុងភាសាកូដ PHP គេចែក OPERATORS ជាពីប្រភេទធំៗ គឺ Conditional Operators និង Logical Operators
                          i.   Conditional Operators

Operators
Description
==
Is equal to
===
Is identical to (is equal and is the same data type)
!=
Is not equal to
!==
Is not identical to
< 
Is less than
<=
Is less than or equal to
> 
Is greater than
>=
Is greater than or equal to
                       ii.   Logical Operators       

Operators
Name
Description
! a
NOT
True if a is not true
a && b
AND
True if both a and b are true
a || b
OR
True if either a or b is true
a and b
AND
True if both a and b are true
a xor b
XOR
True if a or b is true, but not both
a or b
OR
True if either a or b is true
Variable គឺជាឈ្មោះ ឬអថេរ ដែលអនុញ្ញាតិឲ្យយើង អាចកំណត់ ឬផ្ដល់តម្លៃឲ្យវាបាន។ ហើយតម្លៃរបស់វា អាចជា៖ លេខ អក្សរ ខុសឬត្រូវ(True or False)។
Variable ត្រូវសសេរចាប់ផ្ដើមដោយសញ្ញា “$” ហើយបន្ទាប់មកគឺឈ្មោះរបស់ Variable
ឧទារហរណ៏ៈ $you (ពាក្យ you គឺជាឈ្មោះរបស់ Variable ), $sum=90 (ពាក្យ sum គឺជាឈ្មោះ​ របស់ Variable ហើយ 90 ជាតម្លៃរបស់ Variable)
                     iii.   Syntax Variable
Syntax1
$variablename;
Syntax2
$variablename=variable value

កូដ
លទ្ធផល
1
<?php
$a=10;
$b='Your name';
$c=7.7;
$e=true;
echo $a.'<br>';
echo $b.'<br>';
echo $c.'<br>';
echo $e.'<br>';
?>
10
Your name
7.7
1

2
<?php
$a=200;
$b=true;
$c=400.60;
$d="Tula";
echo "\$a=$a has type:".gettype($a)."<br>";
echo "\$d=$d has type:".gettype($d)."<br>";
echo "\$c=$c has type:".gettype($c)."<br>";
echo "\$b=$b has type:".gettype($b)."<br>"?>
$a=200 has type:integer
$d=Tula has type:string
$c=400.6 has type:double
$b=1 has type:boolean





0 សូមធ្វើការតំលៃផង:

Post a Comment

ស្វែងរក

 


MOM TENG
(Web Master , Designer , Journalist , and Video Editor )
Student of Social Communication and Journalism 2nd Generation and 2nd year in
Don Bosco Vocational Center Kep
Email : tengmom20@gmail.com , tengmom20@yahoo.com , tengmom20@hotmail.com , Tel :070286200
Skype : tengmom.donbsco.com , Twitter : momteng , Facebook : តេងវិជ្ជា ដុនបូស្កូ, Google+ : mom teng
My Another Website : cambodian1.wordpress.com , khmernowaday.blogspot.com, cambodianteng.blogspot.com/, My picasa , donboscoke.org
Youtube : My Videos
Address : Thmey Village , Prey Thom Commune , Kep City , Kep Province , Cambodia .
Thank!!!!!