Seeing other languages like Java or C++ String is an Object.
But in PHP is it the same thing ? Should I write string or String?
I know it may be a strange question but I can't find the answer even on php.net
Thank you very much.
A String is not a Object in PHP
by Default
and casting is not required but it can be introduced if you want using scalar_objects
class StringHandler {
public function length() {
return strlen($this);
}
}
register_primitive_type_handler('string', 'StringHandler');
So you can easily have
$str->length();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With