Anonymous View

3v4l.org

run code in 500+ PHP versions simultaneously
<?php //$_POST['event_id'] = '1'; function executeDone() { $eventId = (isset($_POST['event_id'])) ? (int)$_POST['event_id'] : ''; var_dump($eventId); } $res = executeDone(); class TestEvent { public static function getCurrentEvent() { // 開催中のイベントIDを取得 $eventId = 10; return $eventId; } } class TestStatus { private $eventId; private $userId; public function __construct($eventId, $userId) { $this->eventId = $eventId; $this->userId = $userId; } public static function process($userId) { $eventId = TestEvent::getCurrentEvent(); $obj = new TestStatus($eventId, $userId); // 処理 return $data; } } $userId = '123456'; $data = TestStatus::process($userId);
Output for 8.2.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
string(0) "" Warning: Undefined variable $data in /in/mlKup on line 31

preferences:
41.39 ms | 750 KiB | 4 Q