php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24100 Please add "endclass", "endfunction" keywords
Submitted: 2003-06-09 13:21 UTC Modified: 2003-06-09 13:40 UTC
Votes:28
Avg. Score:4.8 ± 0.6
Reproduced:25 of 25 (100.0%)
Same Version:6 (24.0%)
Same OS:11 (44.0%)
From: waxmop at sarcastic-horse dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.2 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: waxmop at sarcastic-horse dot com
New email:
PHP Version: OS:

 

 [2003-06-09 13:21 UTC] waxmop at sarcastic-horse dot com
I really like this alternative syntax:

<?php if($a): ?>
<h1>A is true.</h1>
<?php endif; ?>

I thought I was free from using curly brackets "{}", until I realized that I'd still have to define classes and functions in the old style:

<?php
class Old
{
    var $val;
    function Old($num=0)
    {
        print "<p>Created an object";
        if ($num > 0):
            print "this is mismatched syntax!";
        endif;
    }
}
?>

It seems a little jarring to have to switch back and forth between the "{}" and the alternative style in a class definition.  

It would be nice to be able to create an object with the alternative style syntax rather than with curly brackets.  It could look a little like this:

<?php
class Noo:
    var $val;
    function Noo():
        print "<p>Created a noo object";
    endfunction;
endclass;
?>

Wouldn't that be great?  My apologies if this is a redundant submission.  I searched for endclass and endfunction, but couldn't find them. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-09 13:40 UTC] derick@php.net
The "endif;" stuff is old legacy syntax and is definitely not the recommended way of doing things. For my part if can be removed for PHP 5... anyway, definitely not something we will add.
 [2013-08-29 23:02 UTC] carlos at nodolibre dot org
Well, it seems that we'll have to change to ruby or python.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 14:01:29 2024 UTC