nopaste.info/db39578158.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | <?php /** * funktion die kein argument zum aufrufen benötigt * * @return string * @author Bloody **/ function iReturnYourMother() { return 'your Mother'; } /** * funktion die eine zahl als argument erwartet, sonst wird es mein vater ;) * * @return string (diese funktion wir einen string zurückliefern) * @author Bloody **/ function iReturnYourFather($arg) { if (is_numeric($arg)) { return 'your Father'; }else{ return 'my Father'; } } /** * Diese funktion liefert einen array als returnwert mit 2 elementen * * @return mixed array (Diese funktion liefert einen array zurück) * @author Bloody **/ function iReturnYourParents() { return array('your Mother','your Father'); // kannst auch mal das hier probieren ;) #return array(iReturnYourFather(42), iReturnYourMother()); } /** * diese funktion erweitert den ihr übergebenen array um ein weiteres element * das ergebniss der funktion muss ausgegeben oder einer variablen im anschluss zugewiesen werden * * @return array * @author Bloody **/ function iCreateYourSister($yourParents) { $yourParents[] = 'your Sister'; return $yourParents; } /** * Diese funktion wurde mit einem "&" parameter definiert. * hierbei wird die variable die übergeben wurde nur als referenz übergeben (pointer) * die variable muss nicht mehr zurückgegeben werden, die werte wurden direkt verändert * * @return void * @author Bloody **/ function iManipulateYourFamily(&$yourFamily) { foreach ($yourFamily as $key => $value) { $yourFamily[$key] = str_replace('your', 'my', $value); } return 0; } echo '<b>iReturnYourMother():</b> '; echo iReturnYourMother(); echo '<br/>'; echo '<b>iReturnYourFather(42):</b> '; echo iReturnYourFather(42); echo '<br/>'; echo '<b>iReturnYourParents():</b> '; $myFamily = iReturnYourParents(); echo '<pre>'.print_r($myFamily,true).'</pre>'; echo '<br/>'; echo '<b>iCreateYourSister($myFamily):</b> '; $myFamily = iCreateYourSister($myFamily); echo '<pre>'.print_r($myFamily,true).'</pre>'; echo '<br/>'; echo 'now its last time you see your family ;)'; echo '<br/>'; echo '<b>iManipulateYourFamily($myFamily):</b> '; iManipulateYourFamily($myFamily); echo '<pre>'.print_r($myFamily,true).'</pre>'; echo '<br/>'; echo 'now hands off my family!'; |
/close
verwendete ilchClan Version: 1.1
betroffene Homepage: ilch.de