Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common functions #24

Open
IngwiePhoenix opened this issue Nov 12, 2015 · 3 comments
Open

Common functions #24

IngwiePhoenix opened this issue Nov 12, 2015 · 3 comments

Comments

@IngwiePhoenix
Copy link

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
Copy link
Owner

asmblah commented Nov 12, 2015

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
Copy link
Author

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

@asmblah
Copy link
Owner

asmblah commented Oct 3, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants