2

Deprecated features in PHP 5.3.x

Posted July 22nd, 2010 in Knowledgebase, News, PHP by saturngod

PHP 5.3 မွာ သံုးလုိ႕မရေတာ့တဲ့ function ေတြပါလာပါတယ္။ ကၽြန္ေတာ္ေတာင္ ornagai မွာ split function သံုးထားတာကို ျပန္ျပင္လိုက္ရတယ္။ အဲလိုအခါေတြမွာ ဘာ function အစားထိုးရမလဲဆိုတာကို သိထားဖို႕လိုပါတယ္။ အဲဒီအတြက္လည္း php.net မွာ ညႊန္းဆိုထားျပီးသားပါ။ split အစား preg_split() ကို အစားထိုးသံုးရပါတယ္။ အျခား function ေတြလည္း အစားထိုးေျပာင္းလဲသံုးရတာေတြ ရိွပါတယ္။ deprecated လုပ္လုိက္တာလည္း ေကာင္းပါတယ္။ အခ်ဳိ႕ function ေတြ duplicate ျဖစ္ေနတာေတြရိွေနတယ္။ လိုလည္း မလိုေလာက္ဘူးထင္တာပဲ။ အခ်ဳိ႕ function ေတြက သံုးတဲ့လူေတာ္ေတာ္ ရွားပါတယ္။
Continue Reading »

4

Short Note Of PHP — 2

Posted August 28th, 2009 in Knowledgebase, PHP by saturngod

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);

0

Shortest URL

Posted July 14th, 2009 in Our Site, PHP by saturngod

bit.ly နဲ့ tinyurl တို႔ရဲ့ service ကိုယူျပီးျပန္ေရးထားတယ္။ မူရင္း site ထက္ ျမန္တာေပါ႔။ ဘာလို႔လည္းဆိုေတာ့ ဘာပံုမွ မပါလို႔ပဲဗ်။ ကြ်န္ေတာ္ bit.ly မွာ ဆို ၾကာတယ္လို႔ထင္ရတယ္။ သူ႔ ပံုေတြ loading လုပ္ေနတာေၾကာင့္လည္းပါတယ္။ အဲဒါေၾကာင့္ ကိုယ္႔ဘာသာကိုယ္ သံုးဖို႔အတြက္ ေရးထားတာပါ။ PHP code ကိုေတာ့ http://davidwalsh.name ကေန ယူျပီး jquery နဲ့ ေပါင္းျပီး ေရးထားတာ။ လိပ္စာကေတာ့

http://www.saturngod.net/webtool/

အဲ..ေမ့ေတာ့မလို႔... HTML5 ကိုသံုးထားေတာ့ firefox3.5 နဲ့ chrome 2 မွာမွ အဆင္ေျပမွာေနာ္... :D

0

Image Verify

Posted October 14th, 2008 in Knowledgebase, PHP by saturngod

အင္တာနက္စသံုးကာစက image verify ဘာေၾကာင့္လုပ္ရတယ္ဆိုတာကို ေကာင္းေကာင္းနားမလည္ဘူး။ သူငယ္ခ်င္းတစ္ေယာက္ဆိုရင္ သူ႔မ်က္စိေကာင္းမေကာင္း စစ္တဲ့အေနနဲ့ ထည့္ထားတာလားလို႔ေတာင္ ကြ်န္ေတာ္႔ကို ေမးဘူးတယ္။ အခုတေလာ MZ မွာ ျပသနာေတြ ၾကံဳေတာ့မွ ေကာင္းေကာင္း နားလည္ေတာ့တယ္။
Continue Reading »

2

PHP Manual

Posted July 3rd, 2008 in PHP by saturngod

တျခားလူေတြေတာ့ မသိဘူး.. ကြ်န္ေတာ္ကေတာ့ PHP ေရးမယ္ဆို အရင္တုန္းက online ရိွမွ ေရးလို႔ရတယ္။ ဘာျဖစ္လို႔လည္းဆိုေတာ့ http://php.net/manual/en ကေန လိုခ်င္တဲ့ code နဲ့ပတ္သက္ျပီး သြားသြားရွာရလို႔ပါ။ အမွန္တိုင္းေျပာရင္ mysql နဲ့ အခုခ်က္ခ်င္း ခ်ိတ္ျပဆို ခ်ိတ္ျပဖို႔ ခက္ခဲပါတယ္။

manual ေလးကို သြားျပီး တစ္ေခါက္ဖတ္ျပီးမွ ေရးေနၾကမို႔ပါ။ အဲဒီအတြက္ သူမ်ားေတြေမးရင္ ျပန္ေျဖဖို႔ မလြယ္ဘူး။ online လည္းတက္ၾကည့္လို႔မရဘူး။ ဒါေၾကာင့္ php.net က manual ကို website တစ္ခုလံုး download ဆဲြဖို႔ ၾကိဳးစားေသးတယ္။ ေနာက္မွ မျဖစ္ေသးပါဘူး။ ဘာလို႔ online မွာမရိွရမွာလဲဆိုျပီး google ကေန တက္ရွာလိုက္ေတာ့ ဆိုက္ဆိုက္ျမိဳက္ျမိဳက္ၾကီးကိုေတြ႕ပါတယ္ဗ်ာ။ http://www.php.net/download-docs.php မွာ manual တစ္ခုလံုးကို download ရယူႏိုင္ပါတယ္။ ေတာ္ေတာ္ေလးေတာ့ ဝမ္းသာသြားတာအမွန္ပဲ။ ခက္တာက အက်င့္က အက်င့္ပဲေလ။ google ကေနပဲ သိခ်င္တဲ့ php code ေလးကိုရိုက္ထည့္။ ျပီးရင္ php.net/manual/en ေလးကို ညႊန္းထားတာေလးကို ႏိွပ္။ ဒါေပမယ္႔ အခုေတာ့ online မရိွလည္း OK သြားပါျပီ။

တကယ္ေကာင္းတဲ့ Reference စာအုပ္ေလးပါ။ PHP သမားေတြ ေဆာင္ထားသင့္ပါတယ္ဗ်ာ။

2

regular expression

Posted June 30th, 2008 in PHP by saturngod

အခုမွပဲ သိေတာ့တယ္... ပထမႏွစ္မတိုင္ခင္ကတည္းက regular expression ဆိုတာ သိလာတာ.. နားမလည္ဘူး... ဒါဆိုရင္ နားလည္ေအာင္ ၾကိဳးစားမလား... မထင္နဲ့... ဖတ္ကို မဖတ္တာ... အဲဒါေၾကာင့္ ထိျပီ... တကယ္ဗ်ာ.. တကယ္အသံုးဝင္တဲ့ဟာကို မေလ့လာမိတဲ့အတြက္ ေတာ္ေတာ္ေနာင္တရမိတယ္.. ဘယ္မွာ သံုးရမွန္းမသိ.. ဘယ္လို သံုးရမွန္းမသိေတာ့ မလိုဘူး.. လိုမွ ရွာမယ္.. ကူးလိုက္မယ္... အဲလို မွတ္ထားတာ.. ကိုယ္လိုခ်င္တဲ့ ပံုစံရဖို႔ ေရးရတာ တကယ္မလြယ္ဘူးဗ်ာ.. အေျခခံအားနည္းတာလည္း ပါမွာေပါ႔... ညီအစ္ကိုတို႔ေတြလည္း ေလ့လာထားေစခ်င္တယ္.. တကယ္ေကာင္းျပီး အသံုးတကယ္ဝင္ပါတယ္... အထူးသျဖင့္ data input validation ေတြ replacement ေတြမွာ မျဖစ္မေန သံုးရပါတယ္... searching ေတြမွာလည္း သံုးရပါတယ္... ကြ်န္ေတာ္႔လို ေပါ႔ေပါ႔ဆဆ မလုပ္မိၾကပါေစနဲ့ဗ်ာ...

0

Joomla! 1.5 Availabe

Posted January 29th, 2008 in PHP by saturngod

www.joomla.org မွာ Joomla 1.5 ကိုဆဲြလို႔ရေနျပီေနာ္။ ထြက္တာေတာင္ ၾကာေနျပီ။ ေျပာမယ္ ေျပာမယ္နဲ့ မေျပာျဖစ္ဘူး။ Joomla 1.5 ကေတာ့ လံုးဝကို ကဲြျပားသြားကေတာ့ Admin Panel ပါ။ ေတာ္ေတာ္ေလးလွလာတယ္။ Plugin ေတြ template ေတြ Install လုပ္ရတာ ရိုးရွင္းလြယ္ကူလာတယ္။ ကြ်န္ေတာ္ကေတာ့ 1.5 ကိုပိုၾကိဳက္တယ္ဗ်ာ။

3

PHP And Apache on Windows

Posted April 8th, 2007 in PHP by saturngod

Apache 2.0.59 ကို download ခ်လိုက္ပါ..
2.2.4 ကိုေတာ့ download မခ်နဲ့...
php run လို႔မရဘူး...

အရင္ဆံုး IIS ကိုပိတ္ပါ..
ထို႔ေနာက္ run တြင္ service.msc ကိုrun လိုက္ပါ...
IISAdmin ကို right click -> Stop လုပ္ပါ..

ထို႔ေနာက္ Apache ကို install စလုပ္ပါ...
network domain ကို localhost, servername ကို localhost, admin email ကိုadmin@localhost.com လို႔ထည့္ပါ..

install သြင္းျပီးလွ်င္ browser တြင္ localhost လို႔ရိုက္ထည့္ၾကည့္ပါ...

ျပီးသြားရင္ေတာ့ စျပီး config လုပ္ရမယ္...
D:/Localhost/
ဆိုျပီး folder ေဆာက္လုပ္ပါ

start->apache HTTP server 2.0.59-> Configure Apache Server -> Edit Apache... ကိုသြားလိုက္ပါ...

DirectoryIndex ကို ဒီလိုျပင္လိုက္ပါ..

# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var index.php

ေနာက္ျပီး

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#

အဲဒါကိုရွာပါ..
သူ႔ေအာက္က DocumentRoot ကို..

DocumentRoot "D:\Localhost"

ျပီးရင္ေတာ့ ဒါေလးထပ္ျဖည့္ပါ...

# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#

ScriptAlias /php/ "C:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"
SetEnv PHPRC "C:/php"

အဲဒါဆိုရင္ေတာ့ ျပီးျပီ...

D:/localhost/index.php ဆိုျပီး create လုပ္...
index.php ထဲမွာ..

<php
phpinfo();
?>

ေရးျပီး save လုပ္ပါ..

ျပီးရင္ apache ကို restart လုပ္လိုက္ပါ...
task bar က icon ေတြထဲမွာ apache ပါတယ္..
အဲမွာ click လုပ္လိုက္..
Apache2 -> restart ကိုလုပ္လိုက္ရင္ရပါတယ္..

ျပီးရင္ IE မွာ http://localhost ကိုရွာၾကည့္လိုက္ပါ...
OK ရင္ေတာ့ php info page ကိုျမင္ရပါတယ္..

ဒါေလာက္ဆိုရင္ OK ေလာက္တယ္ေနာ္...

PHP config ကိုေတာ့ ကြ်န္ေတာ္ အရင္တုန္းကေရးထားတဲ့ php ဆိုတဲ့အထဲမွာ ဖတ္ၾကည့္လိုက္ပါ...

PS: Apache သြင္းလို႔မရပါက... www.mystseryzillion.com/forum တြင္ လာေရာက္ေမးျမန္းႏိုင္ပါသည္

5

PHP

Posted December 13th, 2006 in PHP by saturngod

အရင္ဆံုး PHP ကို http://www.php.net ကေန Download ခ် လိုက္ဗ်ာ။ ျပီးရင္ Zip ျဖည္ျပီးေတာ့ C:\PHP ဆိုတဲံ folder ေဆာက္လိုက္။ အဲဒီအထဲကို ကူးခ် Zip ျဖည္ထားတဲ့အထဲမွာ ပါတာေတြကို ကူးခ်လိိုက္။ ကြ်န္ေတာ္ ေျပာတဲ့ သေဘာက C:\PHP\ မွာ ထည့္ခိုင္းတာေနာ္။ အဲဒီ ေအာက္ကို Folder လိုက္ကူးခိုင္းတာမဟုတ္ဘူး။ အဲဒီေအာက္ကို php-cgi.exe ပါတဲ့ ဟာကို ကူးခိုင္းတာ။ အဲဒီမွာ ဘာ Folder ေတြရိွလာမလဲဆို
C:\PHP
.\dev
.\ext
.\extras
.\includes
.\Pears
ဆိုျပီးရိွရမွာ။
php.ini-recommended ကို ေနာက္က -recommended ကိုျဖဳတ္လိုက္ပါ။

ျပီးရင္ C:\PHP\php.ini ကိုျပင္မယ္။
;cgi.force_redirect = 1 ေရွ႕က ; ကိုျဖဳတ္လိုက္။
cgi.force_redirect = 0 လို႔ျပင္လိုက္ပါ။

;include_path = ".;c:\php\includes" ကိုရွာလိုက္ပါ။ ျပီးရင္ ; ကိုျဖဳတ္လိုက္ပါ။
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes"

extension_dir = "./ext/" ဆိုျပီးျပင္ပါ။ ျပီးရင္
extension=php_gd2.dll ကိုေရွ႕က ; ကိုျဖဳတ္လိုက္ပါ။
extension=php_imap.dll ၊ extension=php_mysql.dll တို႔ကို လည္း ေရွ႕က ; ျဖဳတ္လိုက္ပါ။
ျပီးရင္ php_mysql.dll ေအာက္မွာ
extension=php_mysqli.dll
ထပ္ျဖည့္လိုက္ပါ။
ျပီးရင္ save သိမ္းလိုက္ပါ။
IIS ကိုဖြင့္လိုက္ပါ။
Website ေအာက္က Default website ကို r-click လုပ္။ Properties ကို click လုပ္ပါ။ Home Directory ဆိုတဲ့ Tab ကို၀င္လိုက္ပါ။ Configuration Button ကိုႏိွပ္လိုက္ပါ။ Mapping မွာ Add ကိုႏိွပ္။ Executable မွာ C:\PHP\php-cgi.exe ကိုေရြးလိုက္ပါ။ Extension ကို .php လို႔ရိုက္လိုက္ပါ။ ျပီးရင္ Ok ႏိွပ္လိုက္ပါ။
Notepad ထဲမွာ

<?php
phpinfo();
?>

လို႔ရိုက္လိုက္ျပီး C:\Inetpub\wwwroot ထဲမွာ infophp.php အျဖစ္သိမ္းလိုက္ပါ။ ျပီးရင္ IE မွာ http://localhost/infophp.php ကို run လိုက္ပါ။ php နဲ့ ပတ္သက္ျပီး Information ေတြေပၚလာပါမယ္။ ဒါဆိုရင္ PHP သြင္းျပီးသြားျပီ။

PHP 4 နဲ့ PHP 5 ဘာကဲြသလဲဆိုတာေတာ့ ေသေသခ်ာခ်ာမသိဘူး။ ကြ်န္ေတာ္က PHP 4 တုန္းက Database ကို UTF-8 နဲ့သြားသိမ္းလို႔မရဘူး။ PHP5 ေရာက္ေတာ့ သိမ္႔လို႔ရသြားတယ္။ ျမန္မာစာေတြကို ေကာင္းေကာင္းသိမ္းလို႔ရတယ္။ ဒါေပမယ္႔ MYSQL 5 လိုလိမ္႔မယ္။ MYSQL5 မွ UTF-8 ကိုေကာင္းေကာင္းေလး support ေပးထားတယ္။ PHP ကို browser နဲ့ မဆိုင္ဘူးလို႔ထင္တယ္ဗ်။ ဘယ္ browser မွာ မဆို ေကာင္းေကာင္းေလးၾကည့္ႏိုင္ပါတယ္။ ကြ်န္ေတာ္ကေတာ့ IIS ပဲသံုးတယ္။ Aparche Web Server ေပၚမွာ သြင္းနည္းေတာ့ ကြ်န္ေတာ္မသိဘူး။ windows သံုးတဲ့သူေတြကေတာ့ IIS သံုးျပီးေတာ့ Linux သံုးတဲ့သူေတြကေတာ့ Aparche Web Server သံုးတယ္။

MySql ကေရာ MSSQL 2000 တင္ထားတဲ့ စက္မွာ ထပ္တင္လို႔ရပါတယ္။ PHP ေရးမယ္ဆိုရင္ေတာ့ MYSQL သံုးသင့္တယ္။ ဘာျဖစ္လို႔လည္းဆို Free Hosting ရလို႔ပါ။ MSSQL ဆို internet မွာ free မရပါဘူး။
PHP စေလ့လာမယ္႔သူေတြအတြက္ေတာ့ Visual Quick Pro Guide PHP And MYSQL For Dynamic Web Sites ဆိုတဲ့ စာအုပ္ေလးကို recommend ေပးခ်င္ပါတယ္။ သူက PHP3 နဲ့ 4 ရယ္ MYSQL 3 နဲ့ 4 အတြက္ပါ။ version ကေတာ္ေတာ္ေလး out ေနေပမယ္႔ စေလ့လာမယ္႔သူေတြ အတြက္ေတာ့ ေတာ္ေတာ္ေလးေကာင္းပါတယ္။

ေစတန္

4

PHP VS ASP.NET 2005

Posted December 9th, 2006 in PHP by saturngod

PHP လည္း web programming ပါပဲ။ ဒါေပမယ္႔ ဘာေၾကာင့္လူသံုးမ်ားလဲဆိုရင္ Free Download ရလို႔ပါ။ ေနာက္ျပီး သူနဲ့တဲြသံုးတဲ့ MySQL Database ကလည္း Free Download ပါပဲ။ ေနာက္ျပီး Free Hosting ေတြလည္း အမ်ားၾကီးရိွပါတယ္။ ဘာျဖစ္လို႔လည္းဆို Linux sever မွာ run ႏိုင္လို႔ပါ။ Linux server ကေစ်းသက္သာပါတယ္။

ASP.NET ဆိုတာ Microsoft က ထုတ္လိုက္တဲ့ web programming ပါ။ တနည္းေျပာရရင္ VB.NET သို႔မဟုတ္ C#.NET ကိ္ု HTML နဲ့ တဲြလိုက္တာပါ။ အဲဒါက လြယ္ေအာင္ေျပာလိုက္တာပါ။ ဒီထက္က်ယ္ျပန္႔ပါေသးတယ္။ ASP.NET က ေရးမယ္ဆိုင္ Visual Studio .NET 2005 ၀ယ္ရပါမယ္။ ဒါမွ ေရးလို႔ရမွာပါ။ ျမန္မာႏိုင္ငံမွာက 500 က်ပ္ပဲေပးရေပမယ္႔ ႏိုင္ငံတကာမွာ 600 ေလာက္ေပးရတယ္ထင္တယ္။ ဒီထက္မ်ားရင္ မ်ားအံုးမွာ။ ေသေသခ်ာခ်ာမသိလို႔ပါ။ သူနဲ့တဲြသံုုးတဲ့ SQL Server Database ကလည္း ေစ်းေတာ္ေတာ္ေလးေပးရပါတယ္။ ေနာက္ျပီး Free Hosting ေတြက မရိွသေလာက္ရွားတယ္။ ဘာျဖစ္လို႔လည္းဆို Microsoft Server မွာတင္ရတယ္။ သူက ေစ်းေတာ္ေတာ္ေလးမ်ားတယ္ဗ်။

အခုဆိုရင္ PHP ဟာ ASP.NET ထက္ ပို အသံုးမ်ားရသလဲဆိုတာသိေလာက္ပါျပီ။