Vals: Immutable Values
From Nephtali Documentation
Sometimes you need to store data for convenient reuse, and PHP accommodates this through standard variables. However, as the name implies, these values can, well, vary (i.e., they're mutable.) Many functional languages embrace a storage approach in which the default storage type is immutable, avoiding many of the problems associated with unexpected changes to the values. In PHP, there are no immutable values, as variables can change, and constants cannot properly store all types of data (literals, objects, functions.)
To promote a more functional approach, Nephtali provides the n\val() function, which allows you to store a datum that cannot be altered after being set (however, you can mannually set the third argument $is_mutable to true for mutable vars, and if the datum is an object, you'll be able to alter properties of the object after initialization.)
Val Example
// store an int
n\val($name = 'my_int', $value = 23);
// store string
n\val($name = 'my_super_string', $value = 'superdupertelescooper');
// store an array
n\val($name = 'lots_of_money', $value = array('$100','$200','$500'));
// You can't change the value once set (even if it would be more money :)
// This would NOT WORK and would throw an Exception.
n\val($name = 'lots_of_money', $value = array('$1000000', '$2222222'));
// To use a value, just call n\val() with just the name argument
// The call below outputs:
// superdupertelescooper
echo n\val($name = 'my_super_string');
// However, you can specifically pass in a third optional argument, $is_mutable, if you really
// require conveniently accessible mutable values.
n\val($name = 'mutable', $val = 25, $is_mutable = true);
n\val($name = 'mutable', $val = 26);
// Of note, you can only set a var to is_mutable when first saving it. The below example will throw an exception.
n\val($name = 'ex1', $val = 77);
n\val($name = 'ex1', $val = 99, $is_mutable = true); // This won't work and will throw an exception!

