[X] Choose Font Here

Function In PHP

 

PHP မွာ Function ကို ေရးတဲ့ ေနရာမွာ အရမ္းကို လြယ္ကူပါတယ္…ဘာလို ့လဲဆိုေတာ့ တစ္ျခား Programming Language ေတြလို Return ျပန္ရင္တစ္မ်ိဳး ၊ မျပန္ရင္ တစ္မ်ိဳးဆိုျပီး မရွိဘူးဗ်ာ။အားလံုးဟာ တစ္ပံုစံ ပဲရွိတယ္။ Cool

 

 

Function ေရးမယ္ဆိုရင္ သတိထားရမဲ့ အခ်က္ေတြကေတာ့


1. function ေတြအားလံုးကို “function” ဆိုတဲ့ keyword နဲ ့စျပီးေရးရမယ္။


2. function ျပီးရင္ function name ကို ဆက္ျပီးေရးရမယ္။function name ကို letter (သို ့) underscore နဲ ့ စျပီးေရးရမယ္။function name ျပီးရင္ ( ) ကို ထည့္ေပးရပါမယ္…ဆိုလိုတာကေတာ့ function myName ( ) ဆိုတဲ့ သေဘာပါပဲ။


3. ျပီးရင္ “ { “ကို ေရးျပီး ကိုယ္ေရးခ်င္တဲ့ code ေတြကို function ထဲ မွာ ထည့္ေရးလို ့ရပါတယ္။


4. အားလံုးျပီးသြားရင္ေတာ ” } ”နဲ ့ ျပန္ျပီး function ကုိ ပိတ္ေပးရပါမယ္။

 

Example

 

<html>
<body>
<?php
function writeMyName()
{
echo "JoomZack";
}
echo "Hello!<br />";
echo "My name is ";
writeMyName();

?>
</body>
</html>

 

 

တျခား PHP Post ေတြအားလုံး ကို ႏွစ္သက္ရာ ေရြးဖတ္ ခ်င္တယ္ဆိုရင္ ဒီ Link ေလးကို Click လိုက္ပါ။

 

 

 

Comments (2)
  • nwaylay  - rand အေျကာင္း

    mt_rand နဲ့ rand နဲ့ ကြာျခားခ်က္ေလးေျပာပါအုံးေနာ္

  • admin  - Re:

    mt_rand is using Mersenne Twister algorithm for random result. Honestly, I also not sure MT algo. You can take a look at here:
    http://en.wikipedia.org/wiki/Mersenne_twister

Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

Login Form

Categories Table View

JoomlaWatch Stats 1.2.9 by Matej Koval

Facebook Share

Share on facebook

Accordion FAQ

mod_joomtouch

Version Iphone

Version Iphone by JoomTouch