3 ms·
A trivial example: $len = mb_strlen("wtf"); # call function mb_strlen $len = s("wtf")->len(); # call function s # allocate string object
by hearth 14y ago
A trivial example:
$len = mb_strlen("wtf");
# call function mb_strlen
$len = s("wtf")->len();
# call function s
# allocate string object
# instantiate string object
# call string ctor
# set property
# call method len
# get property
# call function mb_strlen
# destroy object
There's no way to use a syntax like this without either massive overhead, or massive changes in the engine.
There is a somewhat similar experimental project - https://github.com/nikic/scalar_objects https://github.com/nikic/scalar_objects - but that's not meant for real world use either.
Personally I think the language, despite its flaws, does its job fine. I don't think it needs turning into Javascript-with-sigils.