Advertisement
Guest User

Callbacks

a guest
May 31st, 2011
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2. function CallThisAsADelegate($stringVar)
  3. {
  4.    echo "Erdbeer".$stringVar;
  5. }
  6.  
  7. function CallsAnotherFunc($func, $param)
  8. {
  9.    echo "<br />geht das hier?<br />";
  10.    echo "geht das hier?<br />";
  11.    $func($param);
  12.    echo "<br />geht das hier?<br />";
  13.    echo "geht das hier?<br />";
  14.    $func($param);
  15.    $func($param);
  16.    echo "nochmal was";
  17. }
  18.  
  19. $irgendwas = function($stringVar)
  20. {
  21.    echo $stringVar;
  22. };
  23.  
  24. CallsAnotherFunc($irgendwas, "Delta");
  25. CallsAnotherFunc("CallThisAsADelegate", "marmelade<br />");
  26. CallsAnotherFunc(function(){echo "mama mia<br />";}, null);
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement