PHP_Beautifier
[ class tree: PHP_Beautifier ] [ index: PHP_Beautifier ] [ all elements ]

Source for file example_main.php

Documentation is available at example_main.php

  1. <html>
  2. </html>
  3. <?php
  4.  
  5.     // Class and Function List    
  6.     // First, the ugly code from the homepage
  7.  for ($i = 0;$i<strlen($str);$i++if ($new_line_counter == 0{if (($i+1<sizeof($a)) if ($a[$i+1== "?" AND $a[$i== "<"out($outstr); out("<?php")$indent++; $new_line_counter++; if (($i+4<sizeof($a)) if ($a[$i+2== "p" AND $a[$i+3== "h" AND $a[$i+4== "p"$i $i+3; $i++; continue; else $outstr.= $a[$i]; continue; } } } }
  8.     // Without Beautify
  9.     // PHP_Beautifier->setBeautify(false);
  10.  for ($i = 0;$i<strlen($str);$i++{if ($new_line_counter == 0{if (($i+1<sizeof($a)) if ($a[$i+1== "?" AND $a[$i== "<"out($outstr); out("<?php")$indent++; $new_line_counter++; if (($i+4<sizeof($a)) if ($a[$i+2== "p" AND $a[$i+3== "h" AND $a[$i+4== "p"$i $i+3; $i++; continue; else $outstr.= $a[$i]; continue; } } } }
  11.  
  12.     // And beautify again!
  13.     // PHP_Beautifier->setBeautify(true);
  14.     // Second, the comments!
  15.     echo $a// inline
  16.     echo $a// inline
  17.     /**
  18. * Multiline
  19.     */
  20.     // and the old folding markers!
  21.     function folder(
  22.     /*{{{{*/
  23.     }   /*}}}*/
  24.     // The power of callbacks: the next line deactivate the Filter ListClassFunction for functions
  25.     // ListClassFunction->includeInList('functions',false);
  26.     function notInList(
  27.     {
  28.     }
  29.     // ListClassFunction->includeInList('functions',true);
  30.     function InList(
  31.     {
  32.     }
  33.     class class_1 extends class_0 {
  34.     }
  35.     // Third, do you remember Pascal?
  36.     if ($a):
  37.         echo 'a';
  38.         echo 'n';
  39.     else:
  40.         echo 'b';
  41.     endif;
  42.     while ($japan):
  43.         echo 'nothing';
  44.     endwhile;
  45.     // Fourth.... The horrible switch inside switch! ... break includes!
  46.     switch ($a{
  47.         case 'a':
  48.         case 'b':
  49.         echo "something";
  50.         break;
  51.  
  52.         default:
  53.             foreach($a as $b{
  54.                 if ($x{
  55.                     break;
  56.                 }
  57.             }
  58.             switch ($b{
  59.                 case 'a':
  60.                     echo 'a';
  61.                 case 'b':
  62.                     echo 'b';
  63.                 break;
  64.  
  65.                 default:
  66.                     echo 'b';
  67.                 break;
  68.             }
  69.         break;
  70.     }
  71.     // ArrayNested->off()    
  72.     // Fifth: Nested arrays...
  73.     $aMyArray = array(
  74.         array(
  75.             array(
  76.                 array(
  77.                     'el'=>1,
  78.                     'el'=>2
  79.                 )
  80.             )
  81.         )
  82.     );
  83.     // =
  84.     $a=5;
  85.     $b="";
  86.     $c=$a.$b;
  87.     $d.=" ".$b;
  88.     // Somebody remember callbacks?
  89.     // ArrayNested->on()
  90.     $aMyArray = array(array(array(array('el'=>1,'el'=>2))));
  91.     // PHP5, dude!
  92.     throw new Exception();
  93.     $o->getArray(-> createNewThing();
  94.     MyFunction :: singleton()->record();
  95.     echo (__FUNCTION__.__LINE__.__CLASS__);
  96.     // Nested ternary operators!!!
  97.     $a ($b($c $d:$e$f;
  98.     // and switch again...
  99.     switch ($b{
  100. case 'a':
  101.     echo 'a';
  102. case 'b':
  103.     echo 'b';
  104. break;
  105.     }
  106. ?>

Documentation generated on Mon, 11 Mar 2019 15:37:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.