Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] dropping curly braces (was: PHP 5.1.0R5 Released) [RSS Feed]

#1 Nov. 17, 2005 21:32:25

Andreas K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] dropping curly braces (was: PHP 5.1.0R5 Released)


Ilia Alshanetsky wrote:Once again, I encourage everyone to take the time to try out this RC and
test it against your code or simply run "make test".Works fine for me, but I've a question about the dropped curly braces.Has there been some public discussion about it recently? I'm sorry if Ihave missed it.Why have curly braces for strings been dropped? Even apart from the factthat the manual states "array-brackets syntax is deprecated as of PHP 4"and AFAIK most people are fine with using curly braces in their scriptsfor many years now - what's the idea behind that change?I think scripts will become more difficult to read, to understand and todebug.e.g. think of something like:

$var = myFunction();
// a lot of code

// a lot of code

switch ($var) {
}You loose the information whether $var is a string or an array (if onlycurly braces were used for strings). That's not a very good example, butI looked at the phpt tests failing because of the Notice: IMO thesesimple files became harder to understand by removing the curly braces.And if you think of more complex scripts, where the variableinitialisation is far away from the code you try to debug... it makes itunecessarily hard to understand the code. And don't forget that you"waste" more time with reading/understanding old code or code written bysomeone else, than writing new code!Perhaps it's no problem for people coming from C programming which areprobably used to char arrays..., but I'm quite sure that it is moredifficult to learn/understand and USE/READ(!) for the average PHPprogrammer. IMO it's very useful to have not the same syntax for arraysand strings.Can someone tell me the reason for this decision?

best regards

PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php


  • Root
  • » PHP
  • » [PHP-DEV] dropping curly braces (was: PHP 5.1.0R5 Released) [RSS Feed]

Board footer

Moderator control

Enjoy the 22nd of March

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support