absint( mixed $maybeint )
Convert a value to non-negative integer.
Contents
Description #Description
Parameters #Parameters
- $maybeint
-
(mixed) (Required) Data you wish to have converted to a non-negative integer.
Return #Return
(int) A non-negative integer.
Source #Source
File: wp-includes/functions.php
function absint( $maybeint ) { return abs( intval( $maybeint ) ); }
Expand full source code Collapse full source code View on Trac
Changelog #Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |
More Information #More Information
Related #Related
Used By #Used By
Used By | Description |
---|---|
wp-admin/includes/post.php: use_block_editor_for_post() |
Return whether the post can be edited in the block editor. |
wp-includes/user.php: wp_validate_user_request_key() |
Validate a user request by comparing the key with the request’s key. |
wp-includes/user.php: wp_get_user_request_data() |
Return data about a user request. |
wp-includes/user.php: wp_send_user_request() |
Send a confirmation request email to confirm an action. |
wp-admin/includes/class-wp-privacy-requests-table.php: WP_Privacy_Requests_Table::get_views() |
Get an associative array ( id => link ) with the list of views available on this table. |
wp-admin/includes/class-wp-privacy-requests-table.php: WP_Privacy_Requests_Table::prepare_items() |
Prepare items to output. |
wp-admin/includes/privacy-tools.php: _wp_privacy_resend_request() |
Resend an existing request and return the result. |
wp-admin/includes/privacy-tools.php: _wp_privacy_completed_request() |
Marks a request as completed by the admin and logs the current timestamp. |
wp-admin/includes/privacy-tools.php: _wp_personal_data_handle_actions() |
Handle list table actions. |
wp-includes/class-wp-user.php: WP_User::for_site() |
Sets the site to operate on. Defaults to the current site. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::handle_load_themes_request() |
Load themes into the theme browsing/installation UI. |
wp-includes/class-wp-roles.php: WP_Roles::for_site() |
Sets the site to operate on. Defaults to the current site. |
wp-admin/includes/class-wp-community-events.php: WP_Community_Events::__construct() |
Constructor for WP_Community_Events. |
wp-admin/includes/class-wp-community-events.php: WP_Community_Events::cache_events() |
Caches an array of events data from the Events API. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::_validate_header_video() |
Callback for validating the header_video value. |
wp-includes/theme.php: get_header_video_url() |
Retrieve header video URL for custom header. |
wp-includes/theme.php: get_header_video_settings() |
Retrieve header video settings. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::prepare_item_for_database() |
Prepares a single user for creation or update. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::delete_item() |
Deletes a single user. |
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php: WP_REST_Comments_Controller::get_items() |
Retrieves a list of comment items. |
wp-includes/class-wp-term-query.php: WP_Term_Query::parse_query() |
Parse arguments passed to the term query with default query parameters. |
wp-includes/load.php: get_current_network_id() |
Retrieves the current network ID. |
wp-includes/class-wp-network-query.php: WP_Network_Query::get_network_ids() |
Used internally to get a list of network IDs matching the query vars. |
wp-includes/script-loader.php: wp_localize_jquery_ui_datepicker() |
Localizes the jQuery UI datepicker. |
wp-includes/class-wp-http-requests-response.php: WP_HTTP_Requests_Response::set_status() |
Sets the 3-digit HTTP status code. |
wp-includes/class-wp-site-query.php: WP_Site_Query::get_site_ids() |
Used internally to get a list of site IDs matching the query vars. |
wp-includes/embed.php: get_oembed_response_data_rich() |
Filters the oEmbed response data to return an iframe embed code. |
wp-includes/embed.php: get_post_embed_html() |
Retrieves the embed code for a specific post. |
wp-includes/embed.php: get_oembed_response_data() |
Retrieves the oEmbed response data for a given post. |
wp-includes/theme.php: get_header_image_tag() |
Create image tag markup for a custom header image. |
wp-includes/media.php: wp_make_content_images_responsive() |
Filters ‘img’ elements in post content to add ‘srcset’ and ‘sizes’ attributes. |
wp-includes/media.php: wp_get_attachment_image_srcset() |
Retrieves the value for an image attachment’s ‘srcset’ attribute. |
wp-includes/media.php: wp_get_attachment_image_sizes() |
Retrieves the value for an image attachment’s ‘sizes’ attribute. |
wp-includes/media.php: wp_calculate_image_sizes() |
Creates a ‘sizes’ attribute value for an image. |
wp-includes/media.php: _wp_get_image_size_from_meta() |
Get the image size as array from its meta data. |
wp-includes/class-wp-http-response.php: WP_HTTP_Response::set_status() |
Sets the 3-digit HTTP status code. |
wp-includes/class-wp-comment-query.php: WP_Comment_Query::get_comment_ids() |
Used internally to get a list of comment IDs matching the query vars. |
wp-includes/comment.php: wp_handle_comment_submission() |
Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
wp-includes/customize/class-wp-customize-cropped-image-control.php: WP_Customize_Cropped_Image_Control::to_json() |
Refresh the parameters passed to the JavaScript via JSON. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::search_available_items_query() |
Performs post queries for available-item searching. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::ajax_load_available_items() |
Ajax handler for loading available menu items. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::ajax_search_available_items() |
Ajax handler for searching available menu items. |
wp-admin/includes/ajax-actions.php: wp_ajax_crop_image() |
Ajax handler for cropping an image. |
wp-includes/link-template.php: get_avatar_data() |
Retrieves default data about the avatar. |
wp-admin/includes/class-custom-background.php: Custom_Background::ajax_background_add() |
Ajax handler for adding custom background context to an attachment. |
wp-admin/includes/class-wp-list-table.php: WP_List_Table::get_pagenum() |
Get the current page number |
wp-admin/includes/misc.php: wp_check_locked_posts() |
Check lock status for posts displayed on the Posts screen |
wp-admin/includes/misc.php: wp_refresh_post_lock() |
Check lock status on the New/Edit Post screen and refresh the lock |
wp-admin/includes/misc.php: wp_refresh_post_nonces() |
Check nonce expiration on the New/Edit Post screen and refresh if needed |
wp-admin/includes/dashboard.php: wp_dashboard() |
Displays the dashboard. |
wp-admin/includes/media.php: get_media_item() |
Retrieve HTML form for modifying the image attachment. |
wp-admin/includes/media.php: media_upload_form() |
Outputs the legacy media upload form. |
wp-admin/includes/ajax-actions.php: wp_ajax_save_attachment_order() |
Ajax handler for saving the attachment order. |
wp-admin/includes/ajax-actions.php: wp_ajax_get_attachment() |
Ajax handler for getting an attachment. |
wp-admin/includes/ajax-actions.php: wp_ajax_save_attachment() |
Ajax handler for updating attachment attributes. |
wp-admin/includes/ajax-actions.php: wp_ajax_save_attachment_compat() |
Ajax handler for saving backward compatible attachment attributes. |
wp-admin/includes/ajax-actions.php: wp_ajax_wp_link_ajax() |
Ajax handler for internal linking. |
wp-admin/includes/ajax-actions.php: wp_ajax_get_comments() |
Ajax handler for getting comments. |
wp-admin/includes/ajax-actions.php: wp_ajax_replyto_comment() |
Ajax handler for replying to a comment. |
wp-admin/includes/ajax-actions.php: wp_ajax_autocomplete_user() |
Ajax handler for user autocomplete. |
wp-admin/includes/revision.php: wp_prepare_revisions_for_js() |
Prepare revisions for JavaScript. |
wp-admin/includes/class-wp-comments-list-table.php: WP_Comments_List_Table::get_views() | |
wp-admin/includes/class-wp-comments-list-table.php: WP_Comments_List_Table::__construct() |
Constructor. |
wp-admin/includes/nav-menu.php: wp_nav_menu_item_post_type_meta_box() |
Displays a meta box for a post type menu item. |
wp-admin/includes/nav-menu.php: wp_nav_menu_item_taxonomy_meta_box() |
Displays a meta box for a taxonomy menu item. |
wp-admin/includes/comment.php: get_pending_comments_num() |
Get the number of pending comments on a post or posts |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::get_header_dimensions() |
Calculate width and height based on what the currently selected theme supports. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::ajax_header_crop() |
Gets attachment uploaded by Media Manager, crops it, then saves it as a new object. Returns JSON-encoded object details. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::ajax_header_add() |
Given an attachment ID for a header image, updates its “last used” timestamp to now. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::ajax_header_remove() |
Given an attachment ID for a header image, unsets it as a user-uploaded header image for the current theme. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::step_2() |
Display second step of custom header image page. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::step_3() |
Display third step of custom header image page. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::js_2() |
Display JavaScript based on Step 2. |
wp-admin/includes/class-custom-background.php: Custom_Background::wp_set_background_image() | |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::register_controls() |
Register some default controls. |
wp-includes/formatting.php: sanitize_option() |
Sanitises various option values based on the nature of the option. |
wp-includes/pluggable.php: wp_rand() |
Generates a random number. |
wp-includes/general-template.php: wp_get_archives() |
Display archive links based on type and format. |
wp-includes/class-wp-query.php: WP_Query::get_posts() |
Retrieves an array of posts based on query variables. |
wp-includes/class-wp-query.php: WP_Query::parse_query() |
Parse a query string and set query type booleans. |
wp-includes/class-wp-query.php: WP_Query::parse_tax_query() |
Parses various taxonomy related query vars. |
wp-includes/load.php: get_current_blog_id() |
Retrieve the current site ID. |
wp-includes/functions.php: get_status_header_desc() |
Retrieve the description for the HTTP status. |
wp-includes/functions.php: number_format_i18n() |
Convert float number to format based on the locale. |
wp-includes/widgets/class-wp-widget-recent-comments.php: WP_Widget_Recent_Comments::update() |
Handles updating settings for the current Recent Comments widget instance. |
wp-includes/widgets/class-wp-widget-recent-comments.php: WP_Widget_Recent_Comments::form() |
Outputs the settings form for the Recent Comments widget. |
wp-includes/widgets/class-wp-widget-recent-comments.php: WP_Widget_Recent_Comments::widget() |
Outputs the content for the current Recent Comments widget instance. |
wp-includes/widgets/class-wp-widget-recent-posts.php: WP_Widget_Recent_Posts::widget() |
Outputs the content for the current Recent Posts widget instance. |
wp-includes/widgets/class-wp-widget-recent-posts.php: WP_Widget_Recent_Posts::form() |
Outputs the settings form for the Recent Posts widget. |
wp-includes/link-template.php: get_post_comments_feed_link() |
Retrieves the permalink for the post comments feed. |
wp-includes/feed.php: rss_enclosure() |
Display the rss enclosure for the current post. |
wp-includes/feed.php: atom_enclosure() |
Display the atom enclosure for the current post. |
wp-includes/class-wp-user-query.php: WP_User_Query::prepare_query() |
Prepare the query variables. |
wp-includes/media.php: wp_video_shortcode() |
Builds the Video shortcode output. |
wp-includes/media.php: wp_get_attachment_image() |
Get an HTML img element representing an image attachment |
wp-includes/media.php: add_image_size() |
Register a new image size. |
wp-includes/post.php: set_post_thumbnail() |
Sets the post thumbnail (featured image) for the given post. |
wp-includes/post.php: wp_get_recent_posts() |
Retrieve a number of recent posts. |
wp-includes/post.php: is_sticky() |
Determines whether a post is sticky. |
wp-includes/post.php: get_post_custom() |
Retrieve post meta fields, based on post ID. |
wp-includes/rewrite.php: url_to_postid() |
Examine a URL and try to determine the post ID it represents. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::mw_getRecentPosts() |
Retrieve list of recent posts. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::mt_getRecentPostTitles() |
Retrieve the post titles of recent posts. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::blogger_getRecentPosts() |
Retrieve list of recent posts. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_getMediaLibrary() |
Retrieves a collection of media library items (or attachments) |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_getComments() |
Retrieve comments. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_newComment() |
Create new comment. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_getPosts() |
Retrieve posts. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_getTerms() |
Retrieve all terms for a taxonomy. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::wp_getUsers() |
Retrieve users. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::_insert_post() |
Helper method for wp_newPost() and wp_editPost(), containing shared logic. |
wp-includes/customize/class-wp-customize-header-image-control.php: WP_Customize_Header_Image_Control::enqueue() | |
wp-includes/customize/class-wp-customize-header-image-control.php: WP_Customize_Header_Image_Control::render_content() | |
wp-includes/comment.php: wp_new_comment() |
Adds a new comment to the database. |
wp-includes/meta.php: delete_metadata() |
Delete metadata for the specified object. |
wp-includes/meta.php: get_metadata() |
Retrieve metadata for the specified object. |
wp-includes/meta.php: metadata_exists() |
Determine if a meta key is set for a given object |
wp-includes/class-wp-editor.php: _WP_Editors::wp_link_query() |
Performs post queries for internal linking. |
wp-includes/meta.php: add_metadata() |
Add metadata for the specified object. |
wp-includes/meta.php: update_metadata() |
Update metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. |
User Contributed Notes #User Contributed Notes
You must log in before being able to contribute a note or feedback.
When passing a negative integer, you’ll get the non-negative, absolute value. Passing a non-int string returns 0, but passing -10, returns 10:
When passing float, it will return integer value
Please note, due to a rounding error (https://bugs.php.net/bug.php?id=33731) you may sometimes get unexpected results for calculations like this: