Below is a link to an article with a list of possible new features for PHP 5.5. This is a list of things being discussed on the PHP internals mailing list -- not the actual list of new features that will be in PHP 5.5. I thought it might be interesting to people here though.
http://nikic.github.com/2012/07/10/What ... -like.html
Possible New Features in PHP 5.5
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Possible New Features in PHP 5.5
(#10850)
Re: Possible New Features in PHP 5.5
I, for one, am particularly interested in the scalar typehinting, getters/setters (aka properties), and generators (like C#'s yield return). List generators are a combination of generators + lambda functions and sound nice too, though I think a foreach+if+yield is pushing it a bit far.
Only thing I don't like in there is the proposed solution for parameter skipping: you aren't so much skipping parameters as you are using the "default" value. I'd rather something closer to
but I'm not sure I'd like to offer that as a solution to programmers who are creating functions with obscenely-long declarations. For error reporting specifically, (a) log errors somewhere, don't suppress them, (b) write it so it doesn't generate errors, or (c) promote it to a class-level (or even system-level) toggle.
Only thing I don't like in there is the proposed solution for parameter skipping: you aren't so much skipping parameters as you are using the "default" value. I'd rather something closer to
Code: Select all
create_query("deleted=0", "name", report_errors: false);- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Possible New Features in PHP 5.5
The 'A simple API for password hashing' could be useful to programmers unfamiliar with the concepts of password hashing but i think it's a double edged sword like the md5() and sha1() functions; helpful but also harmful
One of the comments is about the proposed setter method; the author suggests the first snippet to the one offered by author/s of the article
The original suggestion confuses me; how would you pass an argument to the method? Would it only be applicable to class properties? (This probably isn't a thread for this type of question but i'm curious)
One of the comments is about the proposed setter method; the author suggests the first snippet to the one offered by author/s of the article
Code: Select all
<?php
public $hours {
set ($value) { $this->seconds = $value * 3600; }
}
//
public $hours {
get { return $this->seconds / 3600; }
set { $this->seconds = $value * 3600; }
}
?>“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Possible New Features in PHP 5.5
Frankly, the most practical one I'm glad about is that empty() will work without having to pass a variable. It's quite bothersome that it's been a language construct instead of a function up to this point. I also like the idea of being able to use array access on strings and such.
Re: Possible New Features in PHP 5.5
It'd work like how magic __set works: the syntax is the same but you automagically get the rvalue as an "argument".social_experiment wrote:The original suggestion confuses me; how would you pass an argument to the method? Would it only be applicable to class properties?Code: Select all
<?php public $hours { set ($value) { $this->seconds = $value * 3600; } } ?>
Code: Select all
$object->hours = 123;
// akin to $object->hours->set(123) and the magic $object->__set("hours", 123)