|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2015-06-01 11:13 UTC] chx@php.net
 
-Package: PHP Language Specification
+Package: Variables related
  [2015-06-01 11:13 UTC] chx@php.net
  [2015-06-01 12:45 UTC] cmb@php.net
  [2015-06-02 06:51 UTC] ugoren at interwise dot co dot il
  [2015-06-02 14:42 UTC] rasmus@php.net
  [2015-06-02 14:45 UTC] ugoren at interwise dot co dot il
  [2015-06-02 15:01 UTC] rasmus@php.net
  [2015-06-03 05:25 UTC] ugoren at interwise dot co dot il
  [2015-06-04 01:32 UTC] cmb@php.net
  [2015-06-04 06:16 UTC] ugoren at interwise dot co dot il
  [2019-09-27 13:05 UTC] jasny@php.net
 
-Status: Open
+Status: Not a bug
  [2019-09-27 13:05 UTC] jasny@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
Description: ------------ I would like to have an option to declare immutable variables, for example $a=1;// is a mutable variable #b=1;// is an immutable variable The advantages of immutable variables are numerous: 1. caching function return values 2. parallelism (no shared memory) 3. pass variables by reference 4. Testability, just record a pure function's input and outputs, and you have automatically generated unit-tests. Test script: --------------- //sample code: #a=array(1,2); #a=array(1,3);//ok #a[1]=4;//error: modifying immutable variable //pure functions: function #pure_function(#a,#b) { return #a+#b; }