3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Model { protected $DB; function __construct($rowFields) { global $DB; $this->DB = $DB; foreach ($rowFields as $field => $value) { $this->$field = $value; } } } class NewsModel extends Model { private $NewsID = 0; private $NewsPostedBy = 0; private $NewsCreateDate = 0; private $NewsPublishDate = 0; private $NewsEditDate = 0; private $NewsStatus = 0; private $NewsOrder = 0; private $NewsDataLangID = array(0 => 0); private $NewsDataTitle = array(0 => ''); private $NewsDataSubTitle = array(0 => ''); private $NewsDataSummary = array(0 => ''); private $NewsDataContent = array(0 => ''); private $NewsDataStatus = array(0 => 0); private $NewsDataOrder = array(0 => 0); function __construct($newsRowFields) { parent::__construct($newsRowFields); // // Initialize the model // $this->NewsID = $newsID; // $this->NewsLangID = $newsLangID; // $this->NewsTitle = $newsTitle; // $this->NewsSubTitle = $newsSubTitle; // $this->NewsSummary = $newsSummary; // $this->NewsContent = $newsContent; // $this->NewsPostedBy = $newsPostedBy; // $this->NewsCreateDate = $newsCreateDate; // $this->NewsPublishDate = $newsPublishDate; // $this->NewsEditDate = $newsEditDate; // $this->NewsStatus = $newsStatus; // $this->NewsOrder = $newsOrder; } } /** * View class */ class View { function __construct() { # code... } public function Render(Model $viewName) { $result = include(P_VIEW_DIR_SYS . $viewName . '.php'); } } class NewsListView extends View { function __construct() { $DB -> Select('*') -> From('News JOIN NewsData ON newsID = newsDataRecID') -> Where("newsStatus = 'a' AND newsStatus = 'a'") -> OrderBy('a.newsOrder DESC') -> BeginTransaction(); $errors = false; if ($errors === false) { $DB->Commit(); } else { $DB->RollBack(); } } public function Render(NewsModel $news) { parent::Render($news); } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Declaration of NewsListView::Render(NewsModel $news) must be compatible with View::Render(Model $viewName) in /in/mH4MW on line 93
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of NewsListView::Render(NewsModel $news) should be compatible with View::Render(Model $viewName) in /in/mH4MW on line 93
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: Declaration of NewsListView::Render(NewsModel $news) should be compatible with View::Render(Model $viewName) in /in/mH4MW on line 96
Output for 5.4.20 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Strict Standards: Declaration of NewsListView::Render() should be compatible with View::Render(Model $viewName) in /in/mH4MW on line 96
Output for 5.4.0 - 5.4.19
Strict Standards: Declaration of NewsListView::Render() should be compatible with View::Render(Model $viewName) in /in/J6Uta on line 96
Output for 5.3.28 - 5.3.29
Strict Standards: Declaration of NewsListView::Render() should be compatible with that of View::Render() in /in/mH4MW on line 96
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.27
Strict Standards: Declaration of NewsListView::Render() should be compatible with that of View::Render() in /in/J6Uta on line 96
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/J6Uta on line 5
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/J6Uta on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/J6Uta on line 5
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/mH4MW on line 5
Process exited with code 255.

preferences:
270.08 ms | 401 KiB | 359 Q