|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-22 15:47 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 23:00:01 2025 UTC |
Description: ------------ This is the error I get when I run my script: Fatal error: Access type for interface method Openable::open() must be omitted in C:\Program Files\Apache Group\Apache2\htdocs\zend\interface.Openable.php on line 3 These are my scripts: interface.Openable.php <?php interface Openable { public abstract function open(); public abstract function close(); } ?> class.Jar.php <?php require_once('interface.Openable.php'); class Jar implements Openable { private $contents; public function __construct($contents) { $this->contents = $contents; } function open() { print "The jar is now open<br />"; } function close() { print "The jar is now closed<br />"; } } ?> testOpenable.php <?php require_once('class.Jar.php'); function openSomething(Openable $obj) { $obj->open(); } $objJar = new Jar('Jelly'); openSomething($objJar); ?> If I remove the abstract keyword in interface.Openable.php I don't get the error. Is it because of PHP 5.1.2 and that I need to upgrade? Regards.