Is it possible to make a PHP array read-only after a certain point in the code?

  • Thread starter Thread starter alex
  • Start date Start date
A

alex

Guest
I want to initialize an array variable and then from that point on, make it read-only. Is this possible in PHP?

Thanks
 
Yes it is.

Do two seperate files. One file is the non read only file .php and the other is the read only .php then php include the read only file where you need it to be.
 
no there isn't a way. You can always access the array and change it as long as it is in the scope of that array.
What you can do it set define() and it will always be the value you set through out the script. Then again it will have to be in the working scope.
 
Back
Top