Short Note Of PHP — 2

Integer

ပေါင်းနှုတ်မြှောက်စား ကိစ္စတွေအတွက် အသုံးပြုတယ်။

Strings

စာတွေ text တွေအတွက် အသုံးပြုတယ်။

$str=”Hello World”;

Booleans

True or Flase condition တွေအတွက် အသုံးပြုတယ်။

Compound Data Types

အခြား ထပ်မံပါဝင်တဲ့ data types တွေကတော့

Arrays – variable တစ်ခုထက် ပိုတာတွေကို သိမ်းတယ်။ နောက်ပိုင်း Arrary အပိုင်းမှာ ပါမှာပါ။

Objects – data ကော code ကော နှစ်ခု လုံးပါဝင်ပါတယ်။

Other Data Types

NULL – ဘာမှ မရှိတဲ့ value။ No value ပေါ့။

resource – PHP မှာ သီးသန့်အသုံးပြုတာ။ external resources တွေကို ညွှန်ပြပေးတယ်။

Converting Between Data Types

float နဲ့တွက်ပြီး int ပြန်ထုတ်ချင်တဲ့အခါမှာ

$x =10.88;

echo (int) $x; //outputs 10

Variable

Variable ဆိုတာ temporary storage containers တွေပါ။ Variable name တွေကို a-z,A-Z စပြီးပေးလို့ရပြီး နောက်ပိုင်းမှာ number တွေ လိုက်လို့ရတယ်။ underscore( _ ) လည်းလိုက်လို့ရတယ်။ number တွေနဲ့စပြီးတော့ ပေးလို့မရပါ။ special character တွေပေးလို့မရပါ။ _ နဲ့စပြီးပေးလို့မရဘူး။

$name=”valid”; //Valid Name

$_name=”invalid”; //Invalid Name

$1name=”invalid”; //Invalid Name,start with a number

Variable Variables

$name=’foo’;

$$name=’bar’;

$echo $foo;

//Display ‘bar’

$$ သုံးလိုက်တဲ့အတွက် $name ရဲ့ foo က variable ဖြစ်သွားတယ်။

$name=’123′; // 123 is your variable name, this would normally be invalid.

$$name=’456′; // Assign, you assign a value

echo ${‘123’};

//Finally, using curly braces you can output 456

variable ကလည်း function ဖြစ်နိုင်တယ်။

function myFunc()

{

echo “myFunc”;

}

$f=’myFunc’;

$f(); //wil call myFunc();

Determining If a Variable Exists

Variable ရှိမရှိ စစ်မယ်ဆိုရင် isset ဆိုတာနဲ့ စစ်လို့ရတယ်။ boolean return ပြန်တယ်။ ရှိရင်1 လို့ ပြန်တယ်။

echo isset($x);

4 Comments

  1. thalar says:

    နောက်ထပ်ထပ်ပြီးတော့ PHPပါတ်သတ်တာလေးတွေထပ်ရေးပေးစေချင်ပါသေးတယ်

  2. thalar says:

    နောက်ထက်ဆက်ပြီးတော့ PHP နဲ့ပါတ်သတ်ပြီးအခြေခံကျတာာလေးကိုရေးပေးစေချင်ပါတယ်
    ဥပမာ PHP နဲ့ mysql ကိုဘယ်လိုချိတ်ဆက်ရမလဲ
    PHP ကိုတော့နည်းနည်းသိပြီး mysql ကိုတခါမှမသုံးဖူးလို့ပါရေးပေးစေချင်ပါတယ်

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.