Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14904508
D14070.id34713.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14070.id34713.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -419,6 +419,7 @@
'phutil_console_prompt' => 'console/format.php',
'phutil_console_require_tty' => 'console/format.php',
'phutil_console_wrap' => 'console/format.php',
+ 'phutil_count' => 'internationalization/pht.php',
'phutil_date_format' => 'utils/viewutils.php',
'phutil_deprecated' => 'moduleutils/moduleutils.php',
'phutil_error_listener_example' => 'error/phlog.php',
diff --git a/src/internationalization/pht.php b/src/internationalization/pht.php
--- a/src/internationalization/pht.php
+++ b/src/internationalization/pht.php
@@ -16,3 +16,13 @@
$translator = PhutilTranslator::getInstance();
return call_user_func_array(array($translator, 'translate'), $args);
}
+
+/**
+ * Count all elements in an array, or something in an object.
+ *
+ * @param wild An array or `Countable` object.
+ * @return PhutilNumber Returns the number of elements in the input parameter.
+ */
+function phutil_count($countable) {
+ return new PhutilNumber(count($countable));
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 10, 2:34 PM (6 h, 14 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7120398
Default Alt Text
D14070.id34713.diff (1 KB)
Attached To
Mode
D14070: Add a `phutil_count` function
Attached
Detach File
Event Timeline
Log In to Comment