For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > August 2006 > #38645 [Opn->Csd]: Does the documentation recommend brackets or curly braces for c









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #38645 [Opn->Csd]: Does the documentation recommend brackets or curly braces for c
philip@php.net

2006-08-30, 9:57 pm

ID: 38645
Updated by: philip@php.net
Reported By: z_rules55 at hotmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: philip
New Comment:


Using brackets is recommended. The type juggling section was overlooked
because most of that information does not even belong there so it's now
been removed. These changes will show up when the manual is next built,
thank you for the bug report! :)

Diff is as follows:
http://cvs.php.net/viewvc.cgi/phpdo...=1.166&r2=1.167




Previous Comments:
------------------------------------------------------------------------

[2006-08-29 21:48:48] z_rules55 at hotmail dot com

Description:
------------
I see the documentation as inconsistent in its recommendation of how to
access a string offset. PHP used to use brackets for accessing a
character at an offset in a string, then braces, now back to brackets.
http://us2.php.net/manual/en/langua...pe-juggling.php says:
"PHP 4 introduced the new curly bracket syntax to access characters in
string, use this syntax instead of the one [using brackets] presented
above"

But then it links you to the part on string access by character
(http://us2.php.net/manual/en/langua...s.string.substr),
which states:
"[Characters within strings] may also be accessed using braces like
$str{42} for the same purpose. However, using square array-brackets is
preferred."

Why does that part of the documentation still say to "use this syntax
[with braces] instead of the one [using brackets]"?



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=38645&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com