3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $code = ' /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } '; print_r(token_get_all($code));
Output for 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => 321 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } [2] => 1 ) )
Output for 5.3.0 - 5.4.45, hhvm-3.10.0 - 3.12.0
Array ( [0] => Array ( [0] => 311 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } [2] => 1 ) )
Output for 5.6.0 - 5.6.28
Array ( [0] => Array ( [0] => 314 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } [2] => 1 ) )
Output for 5.5.0 - 5.5.36
Array ( [0] => Array ( [0] => 312 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } [2] => 1 ) )
Output for 5.2.2 - 5.2.17
Array ( [0] => Array ( [0] => 311 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($ [2] => 1 ) [1] => Array ( [0] => 311 [1] => alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } [2] => 14 ) )
Output for 5.1.0 - 5.2.1
Array ( [0] => Array ( [0] => 311 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($ ) [1] => Array ( [0] => 311 [1] => alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } ) )
Output for 5.0.0 - 5.0.5
Array ( [0] => Array ( [0] => 310 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($ ) [1] => Array ( [0] => 310 [1] => alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } ) )
Output for 4.4.2 - 4.4.9
Array ( [0] => Array ( [0] => 309 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($ ) [1] => Array ( [0] => 309 [1] => alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } ) )
Output for 4.3.0 - 4.4.1
Array ( [0] => Array ( [0] => 308 [1] => /** * * @param string $script The PHP script * @param string $class The full qualified class name with namespace * @param string $alias An optional alias for the class */ protected function addUseStatement(&$script, $class, $alias = null) { if (isset($this->getTable()->useStatements) && in_array($class, $this->getTable()->useStatements)) { return; } if ($ ) [1] => Array ( [0] => 308 [1] => alias) { $script = "use $class as $alias;\n$script"; } else { $script = "use $class;\n$script"; } if (!isset($this->getTable()->useStatements)) { $this->getTable()->useStatements = array(); } $this->getTable()->useStatements[] = $class; } ) )