asmblah / uniter

🎉 PHP in the browser and Node.js => Docs: https://phptojs.com/
https://asmblah.github.io/uniter/
Other
446 stars 42 forks source link

Common functions #24

Open IngwiePhoenix opened 9 years ago

IngwiePhoenix commented 9 years ago

This is partially a note to myself.

<?php
$funcs = array(
    "is_callable", "is_number", "is_null",
    "file_exists",
    "class_exists"
);
foreach($funcs as $func) {
    echo "$func => ".(function_exists($func) ? "Yes" : "No")."\n";
}

All of them are "No".

Uniter STL should have these soon. However, empty() also does not exist. This is more a keyword-function, and should be a built-in.

asmblah commented 9 years ago

Hi @IngwiePhoenix,

Thanks for raising this. I think these functions should probably be built-in (in PHPRuntime) really, rather than STL, as PHPRuntime is the library that the Uniter "meta-package" pulls in to define all the non-core functions (which are defined in PHPCore.) I think the STL library will be good for plugging the missing functions while we wait for more optimized versions to be developed in PHPRuntime, though, and optional addon class/functions (perhaps like cURL emulation, over Ajax requests.)

Kind regards, Dan

IngwiePhoenix commented 8 years ago

So, here is a list of functions that seem mandatory for a baseline PHP. I just thought i'd post them here since this issue exists, and to help you track some unimplemented things.

Exists-checks

Variable checks

asmblah commented 7 years ago

Thankyou for this @IngwiePhoenix, this is definitely on my list to sort out in the very near future 😄