3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Album\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; use Album\Model\Album; use Album\Form\AlbumForm; class AlbumController extends AbstractActionController { protected $albumTable; public function indexAction() { return new ViewModel(array( 'albums' => $this->getAlbumTable()->fetchAll(), )); } public function addAction() { $form = new AlbumForm(); $form->get('submit')->setAttribute('value', 'Add'); $request = $this->getRequest(); if ($request->isPost()) { $album = new Album(); $form->setInputFilter($album->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $album->exchangeArray($form->getData()); $this->getAlbumTable()->saveAlbum($album); // Redirect to list of albums return $this->redirect()->toRoute('album'); } } return array('form' => $form); } public function editAction() { $id = (int)$this->params('id'); if (!$id) { return $this->redirect()->toRoute('album', array('action'=>'add')); } $album = $this->getAlbumTable()->getAlbum($id); $form = new AlbumForm(); $form->bind($album); $form->get('submit')->setAttribute('value', 'Edit'); $request = $this->getRequest(); if ($request->isPost()) { $form->setData($request->getPost()); if ($form->isValid()) { $this->getAlbumTable()->saveAlbum($album); // Redirect to list of albums return $this->redirect()->toRoute('album'); } } return array( 'id' => $id, 'form' => $form, ); } public function deleteAction() { $id = (int)$this->params('id'); if (!$id) { return $this->redirect()->toRoute('album'); } $request = $this->getRequest(); if ($request->isPost()) { $del = $request->getPost()->get('del', 'No'); if ($del == 'Yes') { $id = (int)$request->getPost()->get('id'); $this->getAlbumTable()->deleteAlbum($id); } // Redirect to list of albums return $this->redirect()->toRoute('album'); } return array( 'id' => $id, 'album' => $this->getAlbumTable()->getAlbum($id) ); } public function getAlbumTable() { if (!$this->albumTable) { $sm = $this->getServiceLocator(); $this->albumTable = $sm->get('Album\Model\AlbumTable'); } return $this->albumTable; } }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Class "Zend\Mvc\Controller\AbstractActionController" not found in /in/vnItD:10 Stack trace: #0 {main} thrown in /in/vnItD on line 10
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.07 ms | 401 KiB | 8 Q