5. PHP Bangla Tutorial Php Basic.Docx
Total Page:16
File Type:pdf, Size:1020Kb
AAA.A... 1. 2. 3. Syntax 4. (Variables) 5. (String) 6. (Operators) 7. 8. (Loop) 9. While 10. For 11. (Array) 12. (Function) 13. PHP 14. $_GET 15. $_POST BBB.B... • 111.1... | ( Advanced PHP Tut or i al i n Bangl a) • 222.2... (PHP( PHP Dat e Funct i on TutTut ori al i n Bangl a) • 333.3... (PHP( PHP I ncl ude Funct i on Tut ori al i n Bangl a) • 444.4... ((PHP PHP rrequi eq ui re FunctFuncti i on TutTutori ori al i n Bangl a) • 555.5... (PHP( PHP Fi l e Funct i on TutTut ori al i n Bangl a) • 666.6... (PHP( PHP Fi l e Upl oad TutTut ori al i n Bangl a)a)7777.... (PHP( PHP Cooki e Tut orior i al i n Bangl a) • 888.8... (PHP( PHP Sessi on Tut orior i al i n BanglBangl a) • 999.9... (PHP( PHP ErrorEr r or Handl er Tut ori al i n Bangl a) • 10. (PHP Mai l Funct i on Tut ori al i n Bangl a) • 111111.11 ... (PHP( PHP Fi l tter er TutTutori orior i al i n BanglBangl a) CCC.C... • 111.1... | ( PHP Fr amewor k Tut or i al i n Bangl a) • 222.2... ((OOP OOP & PHP Tut orori i al i n Bangl a) • ((OOPHP OOPHP Tut orori i al i n Bangl a) • : :::---- || : :::6666----10 || : : 1111----1515 | | : : 1616----232323 • 444.4... (CodeIgni( CodeI gni tert er Downl oadoad & InstalInstall l TutoriTutorial al iin n Bangl a) • 5. (MVC( MVC St ructr uct ureur e Tut ori al i n Bangl a) • 666.6... (CodeI( CodeI gni t er Conf i guregur e Tut ori al i n Bangl a) • 777.7... (Creat( Cr eat i ng Fi rstr st Appl i cat i on wi t h CodeI gni t er) AAA.A... 1.1.1. | ( PHP Basi c) : : । instruction run ।“ ” handle । Process : (Picture,Content etc) (math calculation,file operation etc) HTML । (PHP) ?: PHP Hypertext Preprocessor , ,HTML-embedded । syntax C,Perl,Java । । (PHP) : .HTML . HTML Form. C । . ?:?:?: hosting( ) । । । । - * . PHP -compitable : apache .PHP * . ( ) . :। Specialized । । webcoachbd.com ।।। 2. (PHP I nst al l at i on Tut ori al i n Bangl a) : । apache :MySQL, । । । । । XAMPP.XAMPP http://www.apachefriends.org/download.php?xampp-win32-1.7.3.exe । XAMPP - XAMPP Control Panel C C:\Program Files\xampp C:\xampp । start click (Apache MySql) । Apache MySql http://localhost । English । ( ) 3. ( PHP Code Wri t t i ng) : C drive XAMPP htdocs web content । www “C:\xampp\htdocs”( :D drive “D:\xampp\htdocs”). “mytest.php” - http://localhost/mytest.php , ? ? : Net Beans, Dreamweaver । , । IDE (Integrated Development Environment). । 4. ( PHP Synt ax Tut ori al i n Bangl a) : extension .php । .html execute । * <?php ?> । * Scripting Block(<?php ?> ) । * instruction(code line) । ( / ) <?php echo"This is my first php page"; ?> mypage.php , htdocs browse save in । http://localhost/mypage.php । echo print. : execute । , । // # /* */ । : , । <?php ?> echo "Hello World! "; echo "Hello World! "; echo "Hello World! "; echo "Hello World! "; echo "Hello World! "; । <?php echo "Hello World!"; echo "Hello World!"; ?> , । 5. (PHP Vari abl es Tut ori al i n Bangl a) : (Container) । String “Hello Bangladesh” integer value 100. ( declare ) , (value) । “$” । * case sensitive. $a_number and $A_number , । * $variable_name = Value; - 1.<?php 2.$hello = "Hello World!"; 3.$a_number = 4; 4.$anotherNumber = 8; 5.?> * “Loosely Typed” declare ( ) । : . letter or “_”(under score) । . alpha-numeric characters underscores. a-z, A-Z, 0-9, or _ . । . । “___”underscore ($my_string) ($myString) । 6. (PHP St ri ng Tut ori al i n Bangl a) : । Career । । । store । , store echo । 1.<?php 2.$my_string = "o merciful make me bold and brave!"; 3.echo " o merciful make me bold and brave!"; 4.echo $my_string; 5.?> $my_string echo , store । store । । । Double quotes Single quotes , apostrophes । 1.<?php 2.$my_string = ‘o merciful make me bold and brave!’; 3.echo ‘o merciful make me bold and brave!’; 4.echo $my_string; 5.?> single quotes - echo ‘PHP it\’s neat’ double quotes single quotes । , quotation । heredoc , । - 1.<?php 2.$my_string = <<<TEST 3.He will be succeeded here 4.and here after! 5.TEST; 6.echo $my_string; 7.?> - *<<< identifier heredoc TEST । * । * ,(indent) । <br>( ) । 7. ( PHP Oper at or s) : - manipulate । .Unary – (operand ) । .Binary- । .Ternary- । Operator -Arithmetic, Assignment, Comparison Operator etc. ( ASSI GNMENT OPERATOPERATOR)OR) । $my_var = 4; $another_var = $my_var; $my_var $another_var . Operator English Example + Addition 2+4 - Subtraction 6-2 * Multiplication 5*3 / Division 15/3 % Modulus 43%10 01.<?php 02.$addition = 2 + 4; 03.$subtraction = 6 - 2; 04.$multiplication = 5 * 3; 05.$division = 15 / 3; 06.$modulus = 5 % 2; 07.echo "Perform addition: 2 + 4 = ".$addition."<br />"; 08.echo "Perform subtraction: 6 - 2 = ".$subtraction."<br />"; 09.echo "Perform multiplication: 5 * 3 = ".$multiplication."<br />"; 10.echo "Perform division: 15 / 3 = ".$division."<br />"; 11.echo "Perform modulus: 5 % 2 = " . $modulus ?> - ( COMPARI SON OPERATOROPERATOR)))) Operator relationship । Operator statement statement true false. Comparison Operator - $x=4 $y=5 Operator English Example Result == Equal to $x=$y False != Not equal to $x!=$y True < Less than $x<$y True > Greater than $x>$y False <= Less than equal to $x<=$y True >= Greater than equal to $x>=$y False ( STRI NG OPERATOR) -“”, ‘’ ARI THMETI C ASSI GNMENT OPERATOR COMBI NATI ON Programming , । $counter=$counter+1; $counter+=1; Pre/Post-Increment Pre/Post-Decrement: , $x++ $x += 1; $x = $x + 1 । “-” । 8. ( PHP Condi t i onal St at ement ) : action । feature “Good Morning” “Good evening” Conditional statement ,condition । Conditional statement - *if statement *if…else statement *if…elseif…else statement *Switch statement * I F STATEMENT if statement execute condition true । Have a nice day Saturday । 1.<?php 2.$d=date("D"); 3.if ($d=="Sat") 4.echo "Have a nice Day"; 5.?> * I F …ELSE STATEMENT , ,। if…else statement । । 1.<?php 2.$d=date("D"); 3.if ($d=="Sat") echo "Have a nice Day"; 4.else 5.echo “Today is not saturday”; 6.?> condition true Saturday Have a nice day Today is not Saturday. * I F …ELSEI F …ELSE STATEMENT statement execute । view source print ? 01.<html> 02.<body> 03.<?php 04.if ($number>=60) 05.echo "First Division"; 06.elseif ($number>=45 and $number<60) 07.echo “Second Division”; 08.elseif($number>=33 and $number<45) 09.echo "Third Division"; 10.else 11.echo “Failed”; 12.?> 13.</body> 14.</html> 9. (PHP Loop Tut ori al i n Bangl a) : । । । statement execute । - While Loop Do…while Loop For Loop Foreach Loop 10. While : condition true while execute । 1.while (condition) 2.{ 3.code to be executed; 4.} condition false । condition ,true execute । condition । : 01.<html> 02.<body> 03.<?php 04.$i=1; 05.while($i<=5) 06.{ 07.echo "The number is " . $i . "<br />"; 08.$i++; 09.} 10.?> 11.</body> 12.</html> i=1. while($i<=5) I । । - The number is 1 The number is 2 The number is 3 The number is 4 The number is 5 I ? while loop execute । DODODO …WHI LE LOOP while loop condition test , , while । execute । 1.Do 2.{ 3.Code to be executed 4.} 5.While(condition); । 01.<?php 02.$i=1; 03.do 04.{ 05.$i++; 06.echo "The number is " . $i . "<br />"; 07.} 08.while ($i<=5); 09.?> i=6 ? This is line 6 This line is outside while loop.so it will not repeat. execute । execution repeat ? while loop । 11. ( PHP For Loop) : । while , । 1.for (init; condition; increment) 2.{ 3.code to be executed; 4.} for loop statement expression । assignment statement(loop control variable), execution । Boolean expression (evaluate) , true false return । loop control variable । i=1 I । I । 1.<?php 2.for ($i=1; $i<=5; $i++) 3.{ 4.echo "The number is " . $i . "<br />"; 5.} 6.?> Output The number is 1 The number is 2 The number is 3 The number is 4 The number is 5 expression expression , । Boolean expression default true । - । foreach loop array 12. (PHP Array Tut ori al i n Bangl a) : single value (container). value’ container । value -key index । single variable store - $city1=