rfc:negative-string-offsets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:negative-string-offsets [2016/01/25 16:10] nikicrfc:negative-string-offsets [2016/03/10 12:07] nikic
Line 1: Line 1:
 ====== PHP RFC: Generalize support of negative string offsets ====== ====== PHP RFC: Generalize support of negative string offsets ======
-  * Version: 1.1 +  * Version: 1.3 
-  * Date: 2016-01-25+  * Date: 2016-02-18
   * Author: François Laupretre <francois@php.net>   * Author: François Laupretre <francois@php.net>
-  * Status: Under discussion+  * Status: Implemented (in PHP 7.1)
   * First Published at: http://wiki.php.net/rfc/negative-string-offsets   * First Published at: http://wiki.php.net/rfc/negative-string-offsets
  
Line 30: Line 30:
 The main objective of this RFC is to improve the overall consistency of the language. The main objective of this RFC is to improve the overall consistency of the language.
  
-===== Feature requests solved by this RFC =====+==== Feature requests solved by this RFC ====
  
   * https://bugs.php.net/bug.php?id=50649   * https://bugs.php.net/bug.php?id=50649
Line 55: Line 55:
 </code> </code>
  
-==== In functions ====+==== In built-in functions ====
  
 ^ Function ^ Add support for ^ ^ Function ^ Add support for ^
Line 71: Line 71:
 | mb_stripos| Negative offset | | mb_stripos| Negative offset |
  
-===== Notes =====+==== Notes ====
  
   * Nothing done for iconv_strrpos() because function does not accept an 'offset' arg (inconsistent with every other xxx_strrpos() functions but argument cannot be added without breaking BC).   * Nothing done for iconv_strrpos() because function does not accept an 'offset' arg (inconsistent with every other xxx_strrpos() functions but argument cannot be added without breaking BC).
Line 105: Line 105:
 ===== Open Issues ===== ===== Open Issues =====
  
-  * Update documentation (waiting for RFC approval)+To do (waiting for RFC approval) 
 + 
 +  * Update documentation 
 +  * Update language specifications
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
Line 113: Line 116:
 ===== Future Scope ===== ===== Future Scope =====
  
-None+==== Recommend using '{}' vs '[]' for string offsets ==== 
 + 
 +It was suggested during the discussion that, since array access and string 
 +offsets are very different operations, the official documentation should 
 +recommend using the '{}' syntax for string offsets, instead of the ambiguous 
 +'[]' syntax (and potentially deprecate '[]' for string offsets in the future). 
 + 
 +On the opposite side, it was also suggested that array access and string offsets 
 +are so closely-related concepts that we should recommend using '[]' in both 
 +cases and disable the alternate '{}' syntax for string offsets ! 
 + 
 +So, as the subject is controversial and very tangential to the subject of this RFC, 
 +it will be left for a future RFC.
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
  
 As this RFC adds support for negative string offsets in the language, it requires a 2/3 majority. As this RFC adds support for negative string offsets in the language, it requires a 2/3 majority.
 +
 +<doodle title="Generalize support of negative string offsets" auth="francois" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/negative-string-offsets.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1