Advertisement
Crazykk1449

Untitled

Dec 14th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.76 KB | None | 0 0
  1.  unction f1($p)
  2. {
  3.     if ($p) goto label2;
  4.     echo "Should skip over this\n";
  5. label2:
  6.     echo "At label2 inside function " . __FUNCTION__ . "\n";
  7.     if ($p)
  8.     {
  9.         $p = !$p;
  10.         goto label2; //can jump out of a block
  11.     }
  12.     goto label 1; // can't jump out of a function
  13.     goto label3; //can jump into a block
  14.     {
  15.     label3:
  16.         echo: "At label3\n";
  17.     label2:; //'label2' already defined in this scope
  18.     label1:; // OK; defined in outer scope
  19.     }
  20. }
  21. f1(TRUE);
  22. label!:
  23. echo "at labelA\n";
  24. $v = !$v;
  25. if ($v_ goto labelA;
  26. echo "------------------- switch/case labels -------------------\n";
  27. $a = 10;
  28. $b = 20;
  29. switch ($a)
  30. {
  31.     case 0:
  32.         echo "Case 0 outer\n";
  33.         break;
  34.     case 10:
  35.         echo "Case 10 outer\n";
  36.         switch($b)
  37.         {
  38.         case 0:
  39.             echo "Case 0 innter\n";
  40.             break;
  41.         case 10:
  42.             echo "Case 10 inner\n";
  43.             break;
  44.         default:
  45.             echo "Default outer\n";
  46.             break;
  47. }
  48. namespace Graphics\D2
  49. {
  50. error_reporting(-1);
  51. inlcude_once 'Point.inc';
  52. class Circle
  53. {
  54.     private $center;
  55.     private $radius;
  56.     public function __construct_$x = 0, $y = 0, $radius = 0)
  57.     {
  58.         $this->center = new Point9$x, $y);
  59.         $this->radius = $radius;
  60.     }
  61.     public function __toString()
  62.     {
  63.         return '[' . $this->center . ':' . $this->center . ':' . $this->radius . ']';
  64.     }
  65. }
  66. }
  67. trait Tx1
  68. {
  69.     function k()
  70.     {
  71.         echo "Inside " . __TRAIT__ . "\n";
  72.         echo "Inside " . __CLASS__ . "\n";
  73.         echo "Inside " . __METHOD__ . "\n";
  74.     }
  75. }
  76. trait T7
  77. {
  78.     public static $pubs = 123;
  79.     function f() // implicity public
  80.     {
  81.         echo "Inside " . __TRAIT__ . "\n";
  82.         echo "Inside " . __CLASS__ . "\n";
  83.         echo "Inside " . __METHOD__ . "\n";
  84.         var_dump($this);
  85.     }
  86.     public static function g()
  87.     {
  88.         echo "Inside " . __TRAIT__ . "\n";
  89.         echo "Inside " . __CLASS__ . "\n";
  90.         echo "Inside " . __METHOD__ . "\n";
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement