├── README.md ├── learnphp1.php ├── learnphp2.php ├── learnphp3.php ├── learnphp4.php └── oop.php /README.md: -------------------------------------------------------------------------------- 1 | # Learn-PHP-codes 2 | helpful files to learn php 3 | -------------------------------------------------------------------------------- /learnphp1.php: -------------------------------------------------------------------------------- 1 | 2 | 12 | 18 | 29 | Get Type"; 33 | echo gettype($var1); 34 | echo "
"; 412 | print_r($array); 413 | echo ""; 414 | 415 | $lastlang = array_pop($array); 416 | echo "
"; 417 | print_r($array); 418 | echo ""; 419 | 420 | echo $lastlang; 421 | 422 | 423 | */ 424 | 425 | ?> 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | -------------------------------------------------------------------------------- /learnphp2.php: -------------------------------------------------------------------------------- 1 | "; 12 | print_r($elements); 13 | echo""; 14 | sort($elements); 15 | echo"
"; 16 | print_r($elements); 17 | echo""; 18 | 19 | 20 | Array Methods - Sort Associative Array 21 | 22 | asort : ranking(value) from a to z and from 0 to ... 23 | arsort: ranking from z to a and from ... to 0 24 | !!!sort and rsort specifique for index array only 25 | 26 | 27 | ksort : ranking(key of Associative Array) from a to z and from 0 to ... 28 | krsort: ranking(key of Associative Array) from z to a and from ... to 0 29 | 30 | 31 | 32 | 33 | $elements= array( 34 | "html"=>54, 35 | "css"=> 70, 36 | "html5"=>45, 37 | "java"=>33, 38 | "php"=>93, 39 | ); 40 | 41 | echo"
"; 42 | print_r($elements); 43 | echo""; 44 | 45 | asort($elements); 46 | echo"
"; 47 | print_r($elements); 48 | echo""; 49 | 50 | 51 | Array Methods - Shuffle, Reverse 52 | 53 | 54 | array_reverse(where,true or false) : by default its false 55 | false : all elements in array it will be reverse with changing the key number ; 56 | true : all elements in array it will be reverse wihtout changing the key number ( every number will stay to own element) 57 | 58 | Shuffle(where): all elements in array it will be reverse but randomly where you do refresh to page, and all key will stay fix, from 0 to ... 59 | 60 | 61 | $elements= array("html","css","html5","java"); 62 | echo"
"; 63 | print_r($elements); 64 | echo""; 65 | $reverse= array_reverse($elements); 66 | echo"
"; 67 | print_r($reverse); 68 | echo""; 69 | 70 | 71 | Array Methods - Array Fill 72 | array_fill(index,how much,value); 73 | 74 | 75 | $array=array_fill(2,10,"moemen"); 76 | echo "
"; 77 | print_r ($array); 78 | echo ""; 79 | 80 | 81 | OUTPUT 82 | ------ 83 | Array 84 | ( 85 | [2] => moemen 86 | [3] => moemen 87 | [4] => moemen 88 | [5] => moemen 89 | [6] => moemen 90 | [7] => moemen 91 | [8] => moemen 92 | [9] => moemen 93 | [10] => moemen 94 | [11] => moemen 95 | ) 96 | 97 | 98 | 99 | $array=array_fill(2,10,array("moemen","ali","abed")); 100 | echo "
"; 101 | print_r ($array); 102 | echo ""; 103 | 104 | 105 | */ 106 | 107 | ?> 108 | "; 139 | echo $array[$rand[1]] ."
"; 150 | print_r ($array); 151 | echo ""; 152 | 153 | $unique= array_unique($array); 154 | echo "
"; 155 | print_r ($unique); 156 | echo ""; 157 | 158 | output 159 | ------ 160 | before 161 | ------ 162 | Array 163 | ( 164 | [0] => moemen 165 | [1] => ali 166 | [2] => abed 167 | [3] => moemen 168 | [4] => khaled 169 | [5] => abed 170 | ) 171 | 172 | 173 | 174 | after 175 | ----- 176 | Array 177 | ( 178 | [0] => moemen 179 | [1] => ali 180 | [2] => abed 181 | [4] => khaled 182 | ) 183 | 184 | 185 | 186 | 187 | 188 | 189 | String Functions - Explode : string to array 190 | 191 | syntax("from where you want to cut the array",array name, limit) 192 | limit its optional , 193 | 194 | 195 | $str= "Hello i love php to much"; 196 | echo $str ."
"; 200 | print_r ($arr); 201 | echo ""; 202 | 203 | 204 | in this case 205 | 206 | $str= "Hello i love php to much"; 207 | echo $str ."
"; 211 | print_r ($arr); 212 | echo ""; 213 | 214 | output: 215 | ------ 216 | Hello i love php to much 217 | Array 218 | ( 219 | [0] => Hello 220 | [1] => i 221 | [2] => love php to much 222 | ) 223 | 224 | --------------------------------------------- 225 | 226 | in limit 0 and 1 its the same 227 | 228 | $str= "Hello i love php to much"; 229 | echo $str ."
"; 233 | print_r ($arr); 234 | echo ""; 235 | 236 | 237 | output: 238 | ------ 239 | Hello i love php to much 240 | Array 241 | ( 242 | [0] => Hello 243 | [1] => i 244 | [2] => love 245 | [3] => php 246 | ) 247 | 248 | 249 | String Functions - Implode/join: array to string 250 | 251 | 252 | $str= array("moemen","ali","khaled","yousof"); 253 | $implode = implode(" & " ,$str); => the first parametre is to separate between elements of function (optional) 254 | 255 | or $implode = join(" & " ,$str); 256 | 257 | echo "Hello our moderators names is ". $implode ; 258 | 259 | 260 | 261 | 262 | String Functions - Str_Split, Chunk_Split 263 | 264 | syntax: str_split(name of string,length) => lenght by default its 1 265 | 266 | $str ="Hello i love php"; 267 | $splite= str_split($str,2); 268 | echo"
"; 269 | print_r ($splite); 270 | echo""; 271 | 272 | output: 273 | ------ 274 | Array 275 | ( 276 | [0] => He 277 | [1] => ll 278 | [2] => o 279 | [3] => i 280 | [4] => lo 281 | [5] => ve 282 | [6] => p 283 | [7] => hp 284 | ) 285 | 286 | 287 | -------------------- 288 | 289 | 290 | syntax: Chunk_Split(name of string,length,end) => lenght by default its 76 , end by default its \r or \n 291 | 292 | $str= "HelloIlovephp"; 293 | $chunk = chunk_split($str,4," @ "); 294 | echo $chunk; 295 | 296 | output 297 | ------ 298 | Hell @ oIlo @ veph @ p @ 299 | 300 | */ 301 | ?> 302 | but tihs optional 309 | 310 | $str="I love php so much because php its a good lang and php is famous"; 311 | $replace =str_replace("php","javascript",$str,$i); 312 | echo $replace."
"; 322 | print_r ($str); 323 | echo ""; 324 | 325 | $replace =str_replace("php","javascript",$str); 326 | echo "
"; 327 | print_r($replace); 328 | echo ""; 329 | 330 | $implode=implode(" ",$replace); 331 | echo $implode; 332 | 333 | 334 | 335 | other example 1: 336 | ---------- 337 | if i want to replace many word in string 338 | 339 | $str="I love|php@so$much|because@php|its@a=good=lang@and|php=is|famous"; 340 | $str= str_replace(array("=","@","|")," ",$str); 341 | echo $str; 342 | 343 | output 344 | -------- 345 | I love php so much because php its a good lang and php is famous 346 | 347 | 348 | other example 2: 349 | ---------- 350 | if i want to replace many word in string 351 | 352 | $str="I love|php@so$much|because@php|its@a=good=lang@and|php=is|famous"; 353 | $str= str_replace(array("=","@","|"),array(" a "," b "," c "),$str); 354 | echo $str; 355 | 356 | output 357 | -------- 358 | I love c php b so much|because b php|its b a a good a lang b and c php a is c famous 359 | 360 | */ 361 | 362 | 363 | ?> 364 | "; 372 | $str= str_repeat($str,20); 373 | echo $str; 374 | 375 | ----------------------------- 376 | 377 | str_shuffle() 378 | 379 | it will mix the lettres randomly when i refresh 380 | 381 | $str ="moemen saade"; 382 | $shuffle= str_shuffle($str); 383 | echo $shuffle; 384 | 385 | ------------------------------- 386 | 387 | strlen() 388 | 389 | $str ="moemen"; 390 | $shuffle= strlen($str); 391 | echo $shuffle; 392 | 393 | !! index starts from 0 394 | !! length starts from 1 395 | 396 | output 397 | ------ 398 | 6 399 | 400 | */ 401 | 402 | ?> -------------------------------------------------------------------------------- /learnphp3.php: -------------------------------------------------------------------------------- 1 | "; 14 | echo addslashes($str) . " This is safe in a database query."; 15 | 16 | output: 17 | Who's Peter Griffin? This is not safe in a database query. 18 | Who\'s Peter Griffin? This is safe in a database query. 19 | 20 | String Functions - Stripslashes 21 | 22 | stripslashes : to remove the slashes 23 | echo stripslashes("Who\'s Peter Griffin?"); 24 | Who's Peter Griffin? 25 | 26 | 27 | String Functions - AddSlashes, Strip_Tags 28 | remove tags 29 | syntax: strip_tags(string,allow) /// allow : the tags that i want to leave it without removing 30 | 31 | echo strip_tags("Hello >world!",""); 32 | 33 | 34 | String Functions - StrToLower, StrToUpper 35 | 36 | 37 | 38 | $normalSting = "moemen saadeh"; 39 | echo $upper = strtoupper($normalSting)."
"; 120 | print_r($myArray); 121 | echo ""; 122 | 123 | output: 124 | ------ 125 | Array 126 | ( 127 | [name] => Peter 128 | [age] => 43 129 | ) 130 | 131 | 132 | String Functions - StrPos, StriPos, StrrPos 133 | 134 | 135 | strpos : sensitive to lettres 136 | stripos : insensitive // // 137 | strrpos : sensitive : it will search from the right but position from left 138 | 139 | 140 | $str= "i love php so much because php is funny"; 141 | $position = strpos($str,"php"); 142 | echo $position; 143 | 144 | output : 7 145 | String Functions - StrStr, StriStr, StrChr 146 | 147 | strstr /StrChr : sensitive 148 | strisrt : insensitive 149 | 150 | 151 | 152 | $str= "i love php so much because php is funny"; 153 | $char= strstr($str,"php",false); by default false 154 | echo $char; 155 | 156 | output: php so much because php is funny 157 | ------- 158 | 159 | -------------------------------- 160 | 161 | $str= "i love php so much because php is funny"; 162 | $char= strstr($str,"php",true); 163 | echo $char; 164 | output: php so much because php is funny 165 | ------- 166 | i love 167 | 168 | */ 169 | ?> 170 | if the 2 variable is the same ,the result will be 0 181 | =>if the variable ($string1) is greater than the over variable , the result will be positif and the sustraction of number between them 182 | as example : 3 183 | =>if the variable ($string2) is greater than the over variable , the result will be negatif and the sustraction of number between them 184 | will be -3 185 | -------------------- 186 | 187 | Strncmp(firstVariable,secondVariable,lenght) 188 | $string1="phpphp"; 189 | $string2="php"; 190 | echo $two=Strncmp($string1,$string2,3); 191 | from length 0 to 3 if the string is the same it will be 0 192 | 193 | --------------------- 194 | strrev: reverse the string 195 | 196 | $str= "moemen"; 197 | echo $reverse = strrev($str); 198 | 199 | output: nemeom 200 | String Functions - SubStr 201 | 202 | substr(name of string, length of start, length ) 203 | 204 | $str="i love php so much because its so beautifull"; 205 | echo $subs= substr($str,7); 206 | 207 | output: php so much because its so beautifull 208 | 209 | ------------------- 210 | substr 211 | 212 | $str="i love php so much because its so beautifull"; 213 | echo $subs= substr($str,7,18); the second parametre starts from offset 7 214 | 215 | output: php so much becaus 216 | 217 | 218 | 219 | String Functions - Substr_[Compare, Count] 220 | 221 | 222 | syntax : substr_count(name of string,"search",start,length) 223 | 224 | $str="i love php so much because php so funny"; 225 | 226 | echo $count= substr_count($str,"php",10,26); 227 | 228 | out : 1 229 | 230 | String Functions - substr_compare 231 | syntax : substr_compare(first string,second string,start from the first string ,lenght of word that i 232 | want to compare it,sensitivity :true or false); 233 | 234 | 235 | 236 | $string1="hello moemen"; 237 | $string2="moemen"; 238 | 239 | echo $string3= substr_compare($string1,$string2,6); 240 | 241 | output: 0 242 | 243 | */ 244 | ?> 245 | 251 | and we have another page "saadeh.php" and in this page we have 252 | if we want to echo this string from page to another page we must to include it like this 253 | 254 | 257 | 258 | include_once/require_once : include this same page 2 time its error and we use include_once ( if this page included , 259 | don't include it , if didnt include 260 | it before , include it) 261 | 262 | require / include the same 263 | but there a one difference between them : if the page doesnt exist include will give a warning and we can hide this warning by 264 | code in php , and the remainder code in the page will work 265 | 266 | but if we use require , it will give a error ! and remainder code willnot work 267 | 268 | 269 | Control Structure - Switch 270 | 271 | 272 | $browser = "google chrome"; 273 | switch($browser){ 274 | case"firefox": 275 | case"mozilla firefox": 276 | echo"your favorite browser is firefox"; 277 | break; 278 | 279 | case"chrome": 280 | case"google chrome": 281 | echo"your favorite browser is google chrome and this is the best"; 282 | break; 283 | 284 | case"safari": 285 | echo"your favorite browser is safari"; 286 | break; 287 | 288 | default: 289 | echo"your favorite browser isnt here"; 290 | } 291 | File System - File_Exists, Is_Writable/dirname(__FILE__) 292 | 293 | 294 | directory of file echo dirname(__FILE__); dirname(__FILE__)=__DIR__ 295 | output: C:\xampp\htdocs\learn\moemen 296 | 297 | 298 | 299 | 300 | $file= "love.txt"; 301 | if(file_exists($file)){ 302 | echo " the file [". $file ."] is found"; 303 | file_put_contents($file,"i love you so much"); 304 | } 305 | else{ 306 | echo " sorry the file [". $file ."] isnt found but i created it with php"; 307 | file_put_contents($file,"I LOVE YOU"); 308 | } 309 | 310 | !!file_exists : to search if the file found 311 | file_put_contents: to write information to file
"; 51 | print_r ($files); 52 | echo""; 53 | 54 | foreach($files as $file){ 55 | 56 | if(is_file($link."/".$file)){ 57 | unlink($link."/".$file); 58 | } 59 | } 60 | 61 | only folder we will stay because we used unlink = file only will remove 62 | output: 63 | ------ 64 | Array 65 | ( 66 | [0] => . 67 | [1] => .. 68 | [2] => ali 69 | [3] => moemen 70 | ) 71 | 72 | 73 | File System - Fopen 74 | 75 | fopen : handling to file 76 | fopen(filename,mode,include_path,context) 77 | 78 | mode: 79 | ----- 80 | r: read only start from the beginning of the file (file must be exist); 81 | r+: read and write start from the beginning of the file (file must be exist); 82 | w: write only (create the file if not exist); /// if there are contents in file it will remove and from starting it will start 83 | W+: write and read (create the file if not exist); /// if there are contents in file it will remove and from starting it will start 84 | a: write only (create the file if not exist);/// if there are contents in file it will leave it and 85 | write after them 86 | a+: write and read (create the file if not exist);///if there are contents in file it will leave it and 87 | write after them 88 | x: write only, (create the file if not exist);/// if the file is exist , it will give a warning or give an error 89 | Warning: fopen(moemen.txt): failed to open stream: File exists in C:\xampp\htdocs\learn\moemen\el zero4.php on line 91 90 | x+: write and read ,(create the file if not exist); /// if the file is exist , it will give a warning or give an error 91 | Warning: fopen(moemen.txt): failed to open stream: File exists in C:\xampp\htdocs\learn\moemen\el zero4.php on line 91 92 | 93 | 94 | File System - Fread 95 | fread(handle(file that i maked it with fopen),length) 96 | 97 | $filehandle= fopen("love.txt","r"); 98 | $filereading= fread($filehandle,filesize("love.txt")); 99 | echo $filereading; 100 | 101 | 102 | File System - Fwrite 103 | 104 | fwrite(handle,string(text that i want to write, length)) 105 | 106 | $filehandle= fopen("love.txt","r+"); 107 | $wite= fwrite($filehandle,"a"); 108 | 109 | os1ma will be as1ma 110 | 111 | File System - Fseek ,fclose 112 | 113 | fseek(handle ,offset,whence" by default SEEK_SET); 114 | whence : SEEK_SET ,SEEK_CUR ,SEEK_END : it start from end to beginning 115 | 116 | 117 | 118 | $filehandle= fopen("love.txt","r+"); 119 | fseek($filehandle,3,SEEK_SET); 120 | $write= fwrite($filehandle,"m"); 121 | fseek($filehandle,5,SEEK_CUR); // it starts from current length ,and we start with 1 ,isnt from 0 122 | $write= fwrite($filehandle,"a"); 123 | 124 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 125 | finally we must to close fopen with fclose fclose(filehandle) 126 | 127 | 128 | Predefined Variables - Globals 129 | 130 | call variable from anywhere 131 | 132 | $name ="moemen"; 133 | $GLOBALS['age'] ="saadeh"; 134 | function testFunc(){ 135 | 136 | echo $GLOBALS['name']; 137 | echo $GLOBALS['age']; 138 | } 139 | testFunc(); 140 | 141 | 142 | */ 143 | ?> 144 | 151 | 182 | 188 | 209 | 244 | 245 | 306 | 307 | output par example : 74H89DT54HS 308 | 309 | Filter - Filter_Var Advanced 310 | 311 | filter_var(variable,type of filter,option) 312 | 313 | 314 | Date - Date Intro 315 | 316 | date_default_timezone_set() 317 | 318 | date_default_timezone_set('Europe/Istanbul'); 319 | echo date('Y-m-d'); 320 | 321 | ------------------- 322 | 323 | Syntax 324 | date(format, timestamp) 325 | Format a local date and time and return the formatted date strings: 326 | example 327 | 328 | date_default_timezone_set('Europe/Istanbul'); 329 | $nextweek= time()+ (7*24*60*60); 330 | echo date('Y-m-d h:i:s' , $nextweek); 331 | 332 | 333 | */ 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | ?> 362 | 363 | -------------------------------------------------------------------------------- /oop.php: -------------------------------------------------------------------------------- 1 | OwnerName)<3){ 21 | echo 'Owner name can\'t be less then 3 chars'; 22 | }else{ 23 | echo 'Your name has been set'; 24 | } 25 | 26 | } */ 27 | 28 | public function setOwnerName($owner){ 29 | if(strlen($owner)
'; 58 | var_dump($iphone6plus); 59 | echo ''; 60 | 61 | 62 | $iphone7plus = new AppleDevice(); 63 | 64 | $iphone7plus->ram ='4GB'; 65 | $iphone7plus->space ='124GB'; 66 | $iphone7plus->inch ='7 inch'; 67 | $iphone7plus->color ='red'; 68 | echo '
'; 69 | var_dump($iphone7plus); 70 | echo ''; 71 | 72 | $iphone = new AppleDevice(); 73 | echo '
'; 74 | var_dump($iphone); 75 | echo ''; 76 | 77 | 78 | 79 | /------------------------------------------------------------------ 80 | 81 | 82 | ram= $ra; 96 | $this->inch=$in; 97 | $this->space=$sp; 98 | $this->color=$co; 99 | } 100 | 101 | public function changeLock($lo){ 102 | $this->lock = sha1($lo) ; 103 | } 104 | } 105 | 106 | 107 | $iphone6plus = new AppleDevice(); 108 | $iphone6plus->ChangeSpec('4GB','7inch','32GB','gold'); 109 | $iphone6plus->changeLock('moemren123'); 110 | 111 | echo '
'; 112 | var_dump($iphone6plus); 113 | echo ''; 114 | 115 | // echo $iphone6plus->lock; 116 | // Cannot access private property AppleDevice::$lock 117 | 118 | $iphone7plus = new AppleDevice(); 119 | $iphone7plus->ChangeSpec('16GB','37inch','64GB','white'); 120 | 121 | 122 | echo '
'; 123 | var_dump($iphone7plus); 124 | echo ''; 125 | 126 | $iphone = new AppleDevice(); 127 | echo '
'; 128 | var_dump($iphone); 129 | echo ''; 130 | 131 | /------------------------------------------------------------------ 132 | 133 | 134 | 135 | ram= $ra; 150 | $this->inch=$in; 151 | $this->space=$sp; 152 | $this->color=$co; 153 | } 154 | 155 | 156 | public function sayHello($n){ 157 | $this->name= $n; 158 | echo "Welcome to " . $n; 159 | } 160 | } 161 | 162 | 163 | 164 | class Sony extends AppleDevice{ 165 | public $screen = 'LCD'; 166 | public function sayHello($n){ 167 | $this->name= $n; 168 | echo "Welcome " . $n; 169 | } 170 | } 171 | 172 | 173 | $iphone6plus = new AppleDevice(); 174 | $iphone6plus->ChangeSpec('4GB','7inch','32GB','gold'); 175 | $iphone6plus->sayHello("IPhone"); 176 | $iphone6plus->price="300$"; 177 | 178 | echo '
'; 179 | print_r($iphone6plus); 180 | echo ''; 181 | 182 | $sony = new Sony(); 183 | $sony->ChangeSpec('90GB','7inch','32GB','gold'); 184 | $sony->sayHello("Sony"); 185 | echo '
'; 186 | print_r($sony); 187 | echo ''; 188 | 189 | 190 | /------------------------------------------------------------------ 191 | 192 | owner=$s; 210 | echo "Welcome " . $s; 211 | } 212 | 213 | } 214 | 215 | class Ipad extends MakeDevice { 216 | public $owner; 217 | public function TestPerfomance(){ 218 | echo "Performance is Good 100%"; 219 | } 220 | public function verifyOwner(){ 221 | echo "Owner is verified"; 222 | } 223 | public function sayWelcome($y){ 224 | $this->owner=$y; 225 | echo "Welcome " . $y; 226 | } 227 | } 228 | 229 | 230 | $iphone = new Iphone(); 231 | $iphone->sayWelcome("Moemen"); 232 | echo '
'; 233 | print_r($iphone); 234 | echo ''; 235 | 236 | $ipad = new Ipad(); 237 | $ipad->sayWelcome("Ahmad"); 238 | echo '
'; 239 | print_r($ipad); 240 | echo ''; 241 | 242 | 243 | 244 | ?> 245 | 246 | /------------------------------------------------------------------ 247 | 248 | getUsers(); 283 | $row->getArticles(); 284 | $row->showStats(); 285 | echo "
"; 286 | print_r($row); 287 | echo ""; 288 | 289 | /------------------------------------------------------------------ 290 | 291 | 292 | name=$na; 299 | $this->ram=$ra; 300 | echo "Hello " . $na . "Your device has " . $ra ." Ram"; 301 | } 302 | } 303 | 304 | 305 | class Sony extends Iphone{ 306 | 307 | } 308 | 309 | $phone = new Iphone("Amani",4); 310 | 311 | 312 | ?> 313 | 314 | WelcomeToApp("Moemen","2GB"); 331 | 332 | 333 | ?> 334 | 335 | /------------------------------------------------------------------ 336 | 337 | ram = "4GB"; 357 | 358 | name= $n; 365 | $this->email= $e; 366 | } 367 | 368 | } 369 | 370 | 371 | $main= new Iphone("Moemen","moemensaadeh3@gmail.com"); 372 | $copy = clone $main; 373 | $main->name="ali"; 374 | $copy->name="khaled"; 375 | 376 | echo "
"; 377 | print_r($main); 378 | echo ""; 379 | 380 | 381 | echo "
"; 382 | print_r($copy); 383 | echo ""; 384 | 385 | ?> 386 | /------------------------------------------------------------------ 387 | 402 | 403 | 404 | 405 | pressPower()->bootPhone()->sayWelcome(); 427 | echo "
"; 428 | print_r($phone); 429 | echo ""; 430 | 431 | ?> 432 | /------------------------------------------------------------------ 433 | fingerFeature()->threeD()->faceFeature()->sayHello(); 497 | echo "
"; 498 | print_r($phone); 499 | echo ""; 500 | 501 | 502 | 503 | $sony = new Sony(); 504 | echo "
"; 505 | print_r($sony); 506 | echo ""; 507 | $sony->faceFeature()->sayHello(); 508 | 509 | 510 | $nokia = new Nokia(); 511 | echo "
"; 512 | print_r($nokia); 513 | echo ""; 514 | $nokia->sayHello(); 515 | ?> 516 | 517 | /------------------------------------------------------------------ 518 | 519 | sayHello(); 539 | echo "
"; 540 | print_r($phone); 541 | echo ""; 542 | 543 | 544 | 545 | ?> 546 | 547 | /------------------------------------------------------------------ 548 | 549 | feature(); 572 | $phone->MoemenFeat(); 573 | echo "
"; 574 | print_r($phone); 575 | echo ""; 576 | 577 | 578 | 579 | /------------------------------------------------------------------ 580 | ?> 581 | 582 | 583 | ?> 584 | 585 | 586 | 587 | ?> 588 | 589 | 590 | 591 | ?> 592 | --------------------------------------------------------------------------------