SlideShare a Scribd company logo
1 of 7
Download to read offline
සිංහලෙන්




Ucscweb.blogspot.com | PHP-01
PHP ඉගෙන ෙන්න කලින් ඔබ HTML ශා JavaScript ඉගෙන ගෙන තිබිය යුතුයි.ඔබ
ඒලා ඉගෙන ගෙන නැත්තම් ඒලා සිංශග඼න් ඉගෙන ෙන්න අගේ බ්ග඼ොග් අඩවියට
(ucscweb.blogspot.com) දැන්ම පිවිගවන්න.

PHP කියන්ගන් Hypertext Preprocessor කියන එකයි. ASP ලගග් PHP
server-side scripting භා඿ාලක්ය.PHP ක්රිකයාත්මක කිමටමට server එකක් අල඾න
ගලනලා.PHP ගෙොඩක් database(MySQL,Informix, Oracle, Sybase,
Solid, PostgreSQL ,Generic ODBC)ල඼ට support කරනලා.ඒලගග්ම PHP
open source software එකක්.

ඔබට PHP install කරෙන්න ශැටි ශා ඒ වමෙ ලැඩ කරන ආකාරය අගේ බ්ග඼ොග් අඩවිගේ
පුළුල් ග඼ව වාකච්චා කර ඇත. ඒ ගලත පිවිව එම පාඩම් අධ්යනනය කරන්න.


Basic PHP Syntax
PHP code එකක ආරම්භ කිමටම ශා අලවාන කිමටම පශතින් දැක්ගේ.

<?php
?>


පශත උදාශරණය බ඼න්න.
ගමහිදී php ශා html ල඼ වම්මිශ්රනණයක් දැකෙත ශැක.


<html>
<body>

<?php
echo "Hello World";
?>

</body>
</html>


ප්රtතිප඼ය :
Comments in PHP

වෑම Variables එකක්ම පටන්ෙත යුත්ගත් $ ඼කුණිනි.



$var_name = value;


පශත උදාශරණය බ඼න්න.


<?php
$txt="Hello World!";
$x=16;
?>

ගලනත් programming language ගනොල php ල඼දී variable ල඼ ග඼ව
එගකහි data type කලින් විව්තර ක඼ යුතු නැත.එය php මගින් automatically
නිලැරදිල ඼බාෙනී.


Variable එකක නමක්
     පටන් ෙත යුත්ගත් අකුරක් ගශෝ underscore "_" ඼කුනකිනි.
     අන්තර්ෙතගේ a-z, A-Z, 0-9, ගශෝ _ තිබිය ශැක.
     තිබිය ශැක්ගක් $my_ucsc ගශෝ$myUcsc ග඼ව පමණි
තිබිය ශැක්ගක් $my_ucsc ගශෝ$myUcsc ග඼ව පමණි




පශත උදාශරණය බ඼න්න.


<?php
$txt="Hello World";
echo $txt;
?>
ප්රtතිප඼ය :




The Concatenation Operator
PHP තිබිය ශැක්ගක් එක string operator පමණි. concatenation operator
(.) පාවිච්චි කරනුගේ string variables ගදකක් එකතු කිමටමටයි.


<?php
$txt1="Hello World!";
$txt2="What a nice day!";
echo $txt1 . " " . $txt2;
?>


ප්රtතිප඼ය :
පශත උදාශරණය බ඼න්න.


<?php
echo strpos("Hello world!","world");
?>
ප්රtතිප඼ය :




ඉතිරිය : www.ucscweb.blogspot.com




PHP පමණක් ගනොල HTML,C++, C ,Joomla, ශා CSS ලැනි සිංශග඼න් පාඩම් ඉගෙන
ෙැනීමට දැන්ම www.ucscweb.blogspot.com(www.ucscweb.tk)බ්ග඼ොග් අඩවියට
පිවිගවන්න.

More Related Content

Viewers also liked

Viewers also liked (16)

Agile Process - Developers Perspective on Scrum
Agile Process - Developers Perspective on ScrumAgile Process - Developers Perspective on Scrum
Agile Process - Developers Perspective on Scrum
 
AL ICT Questions
AL ICT QuestionsAL ICT Questions
AL ICT Questions
 
XHTML
XHTMLXHTML
XHTML
 
Network Devices
Network DevicesNetwork Devices
Network Devices
 
Introduction to XHTML
Introduction to XHTMLIntroduction to XHTML
Introduction to XHTML
 
Xhtml
XhtmlXhtml
Xhtml
 
Grade 10 ICT Short Notes in Sinhala(2015)
Grade 10 ICT Short Notes in Sinhala(2015)Grade 10 ICT Short Notes in Sinhala(2015)
Grade 10 ICT Short Notes in Sinhala(2015)
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
HTML presentation for beginners
HTML presentation for beginnersHTML presentation for beginners
HTML presentation for beginners
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
html5.ppt
html5.ppthtml5.ppt
html5.ppt
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
Html Ppt
Html PptHtml Ppt
Html Ppt
 
Computer for kids
Computer for kidsComputer for kids
Computer for kids
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
LinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-PresentedLinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-Presented
 

Php sinhala(by Prasanga Amila)

  • 2. PHP ඉගෙන ෙන්න කලින් ඔබ HTML ශා JavaScript ඉගෙන ගෙන තිබිය යුතුයි.ඔබ ඒලා ඉගෙන ගෙන නැත්තම් ඒලා සිංශග඼න් ඉගෙන ෙන්න අගේ බ්ග඼ොග් අඩවියට (ucscweb.blogspot.com) දැන්ම පිවිගවන්න. PHP කියන්ගන් Hypertext Preprocessor කියන එකයි. ASP ලගග් PHP server-side scripting භා඿ාලක්ය.PHP ක්රිකයාත්මක කිමටමට server එකක් අල඾න ගලනලා.PHP ගෙොඩක් database(MySQL,Informix, Oracle, Sybase, Solid, PostgreSQL ,Generic ODBC)ල඼ට support කරනලා.ඒලගග්ම PHP open source software එකක්. ඔබට PHP install කරෙන්න ශැටි ශා ඒ වමෙ ලැඩ කරන ආකාරය අගේ බ්ග඼ොග් අඩවිගේ පුළුල් ග඼ව වාකච්චා කර ඇත. ඒ ගලත පිවිව එම පාඩම් අධ්යනනය කරන්න. Basic PHP Syntax
  • 3. PHP code එකක ආරම්භ කිමටම ශා අලවාන කිමටම පශතින් දැක්ගේ. <?php ?> පශත උදාශරණය බ඼න්න. ගමහිදී php ශා html ල඼ වම්මිශ්රනණයක් දැකෙත ශැක. <html> <body> <?php echo "Hello World"; ?> </body> </html> ප්රtතිප඼ය :
  • 4. Comments in PHP වෑම Variables එකක්ම පටන්ෙත යුත්ගත් $ ඼කුණිනි. $var_name = value; පශත උදාශරණය බ඼න්න. <?php $txt="Hello World!"; $x=16; ?> ගලනත් programming language ගනොල php ල඼දී variable ල඼ ග඼ව එගකහි data type කලින් විව්තර ක඼ යුතු නැත.එය php මගින් automatically නිලැරදිල ඼බාෙනී. Variable එකක නමක්  පටන් ෙත යුත්ගත් අකුරක් ගශෝ underscore "_" ඼කුනකිනි.  අන්තර්ෙතගේ a-z, A-Z, 0-9, ගශෝ _ තිබිය ශැක.  තිබිය ශැක්ගක් $my_ucsc ගශෝ$myUcsc ග඼ව පමණි තිබිය ශැක්ගක් $my_ucsc ගශෝ$myUcsc ග඼ව පමණි පශත උදාශරණය බ඼න්න. <?php $txt="Hello World"; echo $txt; ?>
  • 5. ප්රtතිප඼ය : The Concatenation Operator PHP තිබිය ශැක්ගක් එක string operator පමණි. concatenation operator (.) පාවිච්චි කරනුගේ string variables ගදකක් එකතු කිමටමටයි. <?php $txt1="Hello World!"; $txt2="What a nice day!"; echo $txt1 . " " . $txt2; ?> ප්රtතිප඼ය :
  • 7. ප්රtතිප඼ය : ඉතිරිය : www.ucscweb.blogspot.com PHP පමණක් ගනොල HTML,C++, C ,Joomla, ශා CSS ලැනි සිංශග඼න් පාඩම් ඉගෙන ෙැනීමට දැන්ම www.ucscweb.blogspot.com(www.ucscweb.tk)බ්ග඼ොග් අඩවියට පිවිගවන්න.