PHP িটউেটািরয়া-৭

২০ েশ অগা�, ২০১২

(েলখকঃ আহসানু ল হক েশাভন)

গত পেবর্ আমরা একিট এে�প কয্াের�ার েদেখি\n , যা িদেয় েসাসর্ েকােডর মেধয্ নতুন লাইন ৈতির কর যায় । আরও িকছু এে�প কয্াের�ােরর কথা বেল রািখ, পের কােজ িদেব \n = নতুন লাইন ৈতির করেব \f = ফমর্িফড, আসেল এটা িক কােজ লােগ, জািন না, এটার েকানও �েয়াগও েদিখ ন \r = কয্ািরজ িরটানর্, েযমনটা থােক টাইপ রাইটা \t = টয্াব, এক টয্াব পিরমান জায়গা ৈতির ক \d = অ�াল ভয্ালু েলখার জন \x = েহ�ােডিসমল ভয্ালু েলখার জন \a = েবল কয্াের�ার, িটং কের করার কথা, িক� ওেয়ব েপেজ শ� কের না

ভয্ািরেয়ব ে�া�ািমং এ ভয্ািরেয়বেলর গ‍রুপিরসীভয্ািরেয়বল িক? ভয্ািরেয়বল হল একিট কে�ইনার বা পাে মত, যা ডাটা ধারণ কের । ভয্ািরেয়বল িক কােজ লােগ?েকানও ডাটা তাৎ�িণকভােব সংর�ণ করেত এবং তা পের বয্বহারকরেত ভয্ািরেয়বেলর �েয়াজন হয় ভয্ািরেয়বেলর একিট নাম থােক এ ইকুয়াল (=) সাইন িদেয় তার মেধয্ ডাটা রাখা হ । এই ডাটা েট�ট বা না�ার, েয েকানও িকছু ই হেত পাের । PHP েত ভয্ািরেয়বেলর নাম রাখার সময় �থেম একিট ডলার সাইন ($) িদেত হয় । তারপর নােমর �থম অ�রহয় েকানও ইংেরিজ অ�র, না হয় আ�ারে�ার (_) িদেত হেব । এরপর নােমর বাকী অংশিটেত সংখয্া, অ�র ব আ�ারে�ার বয্বহার করা যােব । একট উদাহরণ িদেয় বলেল বু ঝেত সু িবধা হেবঃ $shant এিট একিট ভয্ািরেয়বল, ধির আমরা এর মে1234 সংখয্ািট রাখেত চাই । তাহেল িলখেত হেব $shant = 1234; মেন রাখেবন, PHP েত �িতটা লাইেনর েশেষ েসিমেকালন (;) বাধয্তাম ূলক

PHP িটউেটািরয়া-৭

২০ েশ অগা�, ২০১২

(েলখকঃ আহসানু ল হক েশাভন)

আপিন আপনার ভয্ািরেয়বেলর নাম িক রাখেবন, েসটা আপনার ই�া । িক� একিট ে�ােজে� কাজ করা সময় আপিন যিদ ভয্ািরেবলগ‍েলার নামই�ামেতা িদেত থােকন এবং ভয্ািরেয়বল বাড়েত বাড়েত কেয়কশ হেয় যায়, তখন িক� আপিন আপনার কাি�ত ভয্ািরেয়বলিট সহেজ খ ুঁেজ পােবন না বা আপনার সহকম�র ভয্ািরেয়বলটার �েয়াজনীয়তাটা বুঝেত পারেব না ।তাই �িতটা ভয্ািরেয়বেলর কাজ অনুযায়ী এর নামকরন করু। েযমন, একিট ভয্ািরেয়বেল আপিন ইউজােরর নাম সংর�ণ করেত চান । তাহেল েসই ভয্ািরেয়বলট নাম রাখু ন $user_name এবং পােশ কেম� কের িদন //variable to store user name. এবার িন�য়ই এই ভয্ািরেয়বলিটর কাজ স�েকর্ কামেনই েকানও সে�হ থাকার কথা না । ভ টািউরবউাি াকেু েটেট েটলপ িউরউে । PHP েত মূলত ৩ ধরেণর ডাটা টাইপ ধরা হয় । ১) Integer অথর্াৎ পূণর্ সংখয্া, যার সােথ েকানও দশিমক যু� েনই । েযম9654 বা -586 ২) Floating point numbers অথর্াৎ দশিমক যু� সংখয্া । েযমন6978.30 বা -1.54 ৩) Strings অথর্াৎ েট�ট । েযমনঃ“shant”, ‘shant’, “shant897”, ‘shant93’, “s”, ‘s’ এখােন ল�ণীয় েয, String টাইেপর ভয্ািরেয়বেলর িভতর ডাটা রাখার সময়single quotation (‘) বা double quotation (“) বয্বহার করেত হেব আরও িকছু ডাটা টাইপ রেয়েছ, যা এই মু হূেতর ্ �েয়াজনীয় নয় । এবার আসু ন আমরা ভয্ািরেয়েলর ডাটা টাইপগ‍েলার একটু বা�ব �েয়াগ েদিখ
PHP িটউেটািরয়া-৭

২০ েশ অগা�, ২০১২

(েলখকঃ আহসানু ল হক েশাভন)

//now printing them with a single print() function :-) print “Integer data type: $int
Floating point data type: $float
String data type: $str”; ?> উপেরর উদাহরণিটর আর িবে�ষেণর �েয়াজন েদখিছ না, তেব একটা িজিনস ল�ণীয় ।print() ফাংশনিটেক মা� একবার বয্বহার করা হেয়েছ এবং এরিভতের যতখু িশ খািল ে�স েদওয়া যায়, পেরর লাইেন চেল যাওয়া যায়, শ‍ধু সবেশেষ েসিমেকালটা (;) িঠকমত িদেলই চলেব PHP েত িকছু ভয্ািরেয়বল ৈির করা আেছ, যা শ‍ধু নাম ধের ববহার করেলই তাৎ�িণকভােব ফলাফল পাওয়া যােব । আমরা এটা আেরকিট উদাহরেণর মাধয্েম েদি �টটেটউি আটেপু েেট একদম াহাোবাে উসউে, তটল নট? বটি আআিট েকটেেটি বটলউি HTML
 টয্াগটা বয্বহার কির 
 

PHP িটউেটািরয়া-৭

২০ েশ অগা�, ২০১২

(েলখকঃ আহসানু ল হক েশাভন)

//calling a predefined PHP variable print_r ($_SERVER); ?>
এবার িক� আউটপু টটা েবশ েগাছােনা অব�ায় এেসেছ । ছিবেত আউটপু ট েদখু নঃ

PHP র এরকম আরও িকছু predefined ভয্ািরেয়বল হল $_GET = HTML ফেমর্রGET েমথড িদেয় েযসব ডাটা েপা� হয়, তা এখােন ে�ার করা থােক $_POST = HTML ফেমর্রPOST েমথড িদেয় েযসব ডাটা েপা� হয়, তা এখােন ে�ার করা থােক

PHP িটউেটািরয়া-৭

২০ েশ অগা�, ২০১২

(েলখকঃ আহসানু ল হক েশাভন)

$_COOKIE = COOKIE সং�া� ডাটা এখােন ে�ার করা থােক $_FILES = ফাইল আপেলাড সং�া� ডাটা এখােন ে�ার করা থােক $_ENV = সাভর ্া ENVIRONMENT সং�া� ডাটা এখােন ে�ার করা থােক $_SESSION = SESSION সং�া� ডাটা এখােন ে�ার করা থােক এই মু হূেতর ্ হয়েতা ভয্ািরেয়বলগ‍েলার কাজ িঠকমত বুঝা যাে� না, তেব সামেন এগ‍েত থাকেল আে� বয্াপারগ‍েলা পির�ার হেয় যােব এবার আিস Constant �সে� । এটাও ভয্ািরেয়বেলর মতই, িক� সাধারণ ভয্ািরেয়বেলর িভতরকার ডাট যখন খু িশ েচ� করা যায়, Constant ভয্ািরেয়বেলরটা যায় না ।অথর্াৎ একিট সাধারণ ভয্ািরেয়বেল আপ ডাটা রাখেলন $age = 28, িকছু �ণ পর মত বদেল ডাটা েচ� কের রাখেলন $age = 30. Constant ভয্ািরেয়বেল ে�ে� এ বয্াপারটা করা যােব না । �থেম েয ভয্ালু েরেখিছেলন, েসটাই অিবকৃত থাকেব Constant ভয্ািরেয়বল িডে�য়ার করার প�িতটাও িভ� define(“PI”, 3.14159); Constant ভয্ািরেয়বল িডে�য়ার করার সময়define ফাংশনটা বয্বহার করেত হয় ।এখােন Constant ভয্ািরেবলটার নাম হল PI আর ভয্ািরেয়বেলর ভয্ালু হ3.14159 েযেহতু এটা PI এর মান, এই ভয্ালুি পরবত�েত েচ� করার েকানও �েয়াজন পড়েব না, তাই এটােক Constant ভয্ািেয়বল িহেসেব িডে�য়ার করা হল । Constant ভয্ািরেয়বল বয্বহার করার প�িতটা আমরা একিট উদাহরেণর মাধয্েম ে
PHP িটউেটািরয়া-৭

২০ েশ অগা�, ২০১২

(েলখকঃ আহসানু ল হক েশাভন)

print "PI: " . PI; ?>

PHP র িকছু predefined constant ভয্ািরেয়বল হল __FILE__ = েয ফাইলটা বা ওেয়ব েপজটা এই মু হূেতর ্ রান করেছ, েসটার নম ও েলােকশন __LINE__ = __LINE__ Constant টা েয লাইেন আেছ, তার না�ার PHP_VERSION = আপনার সাভর ্ােররPHP ভাশর্ PHP_OS = PHP েয সাভর ্াের রান করেছ, েসটার অপােরিটং িসে আসু ন এবার Constant গ‍েলা েট� কের েদখা যাক
echo "

Some details of this server:

";

//printing predefined constants print "File name: " . __FILE__ . "
"; print "Line number: " . __LINE__ . "
"; print "PHP version: " . PHP_VERSION . "
";

PHP িটউেটািরয়া-৭

২০ েশ অগা�, ২০১২

(েলখকঃ আহসানু ল হক েশাভন)

print "Operating system: " . PHP_OS . "

";

?>

ছিবেত আউটপু ট েদখু নঃ

আজ খটউনল েশষ কিাে, আজ ঈউরি ারন, তটল সবটলউক ঈদ আু বটিটক । েবখ উত কটকউা েরখট হউব, লনশট�টহ।

Author: Ahsanul Haque Shovon Email: [email protected] August 20, 2012

PHP Tutorial 7.pdf

There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. PHP Tutorial 7.

163KB Sizes 19 Downloads 367 Views

Recommend Documents

PHP Tutorial 3
To keep the Vendors and Products tables connected, so that you know which vendor manufactures which product ... from the Table menu. These three steps set up the name, database, and table required for the recordset. For a recap of creating recordsets

5. PHP bangla tutorial php basic.pdf
... below to open or edit this item. 5. PHP bangla tutorial php basic.pdf. 5. PHP bangla tutorial php basic.pdf. Open. Extract. Open with. Sign In. Main menu.

HTML & PHP Tutorial 4.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. HTML & PHP ...

tutorial php lengkap pdf
Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. tutorial php lengkap pdf. tutorial php lengkap pdf. Open. Extract.

best php tutorial pdf
There was a problem loading more pages. best php tutorial pdf. best php tutorial pdf. Open. Extract. Open with. Sign In. Main menu. Displaying best php tutorial ...

tutorial php mysql lengkap pdf
Download. Connect more apps... Try one of the apps below to open or edit this item. tutorial php mysql lengkap pdf. tutorial php mysql lengkap pdf. Open. Extract.

tutorial on php in pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. tutorial on php in ...

php mvc framework tutorial pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Whoops! There was a problem previewing this document. Retrying... Download. Connect ...

tutorial on php in pdf
Page 1 of 1. File: Tutorial on php in pdf. Download now. Click here if your download doesn't start automatically. Page 1 of 1. tutorial on php in pdf. tutorial on php ...

pdf php tutorial for beginners with examples
Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying... Download. Connect more ...

object oriented programming php tutorial pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. object oriented ...

object oriented programming php tutorial pdf
object oriented programming php tutorial pdf. object oriented programming php tutorial pdf. Open. Extract. Open with. Sign In. Main menu. Displaying object ...

PHP Tutorial - Guest Book - System definition and requirements.pdf ...
PHP Tutorial - Guest Book - System definition and requirements.pdf. PHP Tutorial - Guest Book - System definition and requirements.pdf. Open. Extract.

man-60\php-project-tutorial-pdf.pdf
Connect more apps... Try one of the apps below to open or edit this item. man-60\php-project-tutorial-pdf.pdf. man-60\php-project-tutorial-pdf.pdf. Open. Extract.

PHP Tutorial creating db and webpages with PHP.pdf
Page 3 of 508. Programming PHP. Rasmus Lerdorf and Kevin Tatroe. with Bob Kaehms and Ric McGredy. Beijing • Cambridge • Farnham • Köln • Paris ...

man-60\php-projects-tutorial-video.pdf
man-60\php-projects-tutorial-video.pdf. man-60\php-projects-tutorial-video.pdf. Open. Extract. Open with. Sign In. Main menu.

php mysql shopping cart tutorial pdf
... apps below to open or edit this item. php mysql shopping cart tutorial pdf. php mysql shopping cart tutorial pdf. Open. Extract. Open with. Sign In. Main menu.

man-60\php-projects-tutorial-video.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item.

FeynRules Tutorial
We will call mass eigenstates Φ1 and Φ2, and their masses M1 and M2, ... (3) where u and e are the SM up-quark and electron fields. Note that there is a Z2 symmetry ..... The kinetic terms for the fermions can be implemented in a similar way.

LaTeX Tutorial
To have formulas appear in their own paragraph, use matching $$'s to surround them. For example,. $$. \frac{x^n-1}{x-1} = \sum_{k=0}^{n-1}x^k. $$ becomes xn − 1 x − 1. = n−1. ∑ k=0 xk. Practice: Create your own document with both kinds of for

FeynRules Tutorial
The model we are considering depends on 9 new parameters, .... approach, and we start by opening a new notebook and load the FeynRules package (see the ...

ENVI Tutorial
Navigate to the Data\can_tm directory, select the file can_tmr.img from the list, and click. Open. .... From the ROI Tool dialog menu bar, select File > Restore ROIs.