Common functions
Opened this issue · 3 comments
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.
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
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
- function_exists
- class_exists
- method_exists
- isset
- defined
- file_exists (Maybe)
Variable checks
- empty
- is_null
- is_callable
- is_bool
- is_int, is_float, is_numeric, is_integer
- is_string
- is_array
- is_object
- is_a
- is_nan
Thankyou for this @IngwiePhoenix, this is definitely on my list to sort out in the very near future 😄