Underscore.php understands that by providing a comprehensive interface that works with almost every data-type so you don't have to worry about whether you can or cannot use a function/method.īasically, Underscore.php uses 3 main data-types: PHP is loosely typed, which means that the data you're manipulating are more important than their structure. For instance, if you want to map every item from an iterator using array_map, you have to translate it into an array first or write the mapping yourself using a loop. Not only types are sometimes ambiguous, they don't fit in every API function/method. Juggling with types in PHP can be tedious. This library is in beta phase: you are strongly encouraged to try it and to contribute.Feel free to file an issue if you encounter a bug or an unexpected result. Underscore.php is strongly inspired by Underscore.js and try to be consistent with it as much as possible (PHP language limitation doesn't allow full coverage - especialy for Functions functions.) Don't hesitate to report any discrepancy with Underscore.js. Underscore.php aims to correct that by providing simple, consistent and data-type tolerant 80-odd functions that support both the usual functional suspects: map, select, invoke - as well as more specialized helpers: function binding, php templating, deep equality testing, and so on. Many functions within a similar field - for instance array functions - may have inconsistent names and prototypes. So I achieved almost all of that with the OP expression, but I can't figure out how to achieve the last requirement, which would also help to achieve the previous one (excluding any part of the tag where a single underscore is not followed by a letter or a number would exclude any multiple underscores).PHP lacks consistency, that's a fact.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |