The value of a class constant in PHP cannot be changed once it is ______.

  • defined
  • accessed
  • assigned
  • declared
The value of a class constant in PHP cannot be changed once it is assigned. Once a constant is defined with a specific value, it remains the same throughout the execution of the script. Constants are considered as read-only values. It's important to note that attempting to modify a constant's value will result in a runtime error. To maintain the immutability of constant values, it is recommended to define them with the desired value and avoid any attempts to modify them later. To know more, refer to: http://php.net/manual/en/language.constants.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *