^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 5年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云1核2g仅需102元/年,今日10点开抢

wordpress函数absint()用法示例

absint( mixed $maybeint )

描述

将值转换为非负整数。


参数

$maybeint
(mixed)
(Required)
希望转换为非负整数的数据。

返回值

(int) 一个非负整数。


源代码

File: wp-includes/functions.php

function absint( $maybeint ) {
	return abs( intval( $maybeint ) );
}

更新日志

Version 描述
2.5.0 Introduced.

更多信息

Synonym of abs( intval( $foo ) );


相关函数

Used By

  • wp-admin/includes/class-wp-community-events.php:
    WP_Community_Events::__construct()
  • wp-admin/includes/class-wp-community-events.php:
    WP_Community_Events::cache_events()
  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::_validate_header_video()
  • wp-includes/theme.php:
    get_header_video_url()
  • wp-includes/theme.php:
    get_header_video_settings()
  • wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:
    WP_REST_Users_Controller::prepare_item_for_database()
  • wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:
    WP_REST_Users_Controller::delete_item()
  • wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:
    WP_REST_Comments_Controller::get_items()
  • wp-includes/class-wp-term-query.php:
    WP_Term_Query::parse_query()
  • wp-includes/load.php:
    get_current_network_id()
  • wp-includes/class-wp-network-query.php:
    WP_Network_Query::get_network_ids()
  • wp-includes/script-loader.php:
    wp_localize_jquery_ui_datepicker()
  • wp-includes/class-wp-http-requests-response.php:
    WP_HTTP_Requests_Response::set_status()
  • wp-includes/class-wp-site-query.php:
    WP_Site_Query::get_site_ids()
  • wp-includes/embed.php:
    get_oembed_response_data_rich()
  • wp-includes/embed.php:
    get_post_embed_html()
  • wp-includes/embed.php:
    get_oembed_response_data()
  • wp-includes/theme.php:
    get_header_image_tag()
  • wp-includes/media.php:
    wp_make_content_images_responsive()
  • wp-includes/media.php:
    wp_get_attachment_image_srcset()
  • wp-includes/media.php:
    wp_get_attachment_image_sizes()
  • wp-includes/media.php:
    wp_calculate_image_sizes()
  • wp-includes/media.php:
    _wp_get_image_size_from_meta()
  • wp-includes/class-wp-http-response.php:
    WP_HTTP_Response::set_status()
  • wp-includes/class-wp-comment-query.php:
    WP_Comment_Query::get_comment_ids()
  • wp-includes/comment.php:
    wp_handle_comment_submission()
  • wp-includes/customize/class-wp-customize-cropped-image-control.php:
    WP_Customize_Cropped_Image_Control::to_json()
  • wp-includes/class-wp-customize-nav-menus.php:
    WP_Customize_Nav_Menus::search_available_items_query()
  • wp-includes/class-wp-customize-nav-menus.php:
    WP_Customize_Nav_Menus::ajax_load_available_items()
  • wp-includes/class-wp-customize-nav-menus.php:
    WP_Customize_Nav_Menus::ajax_search_available_items()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_crop_image()
  • wp-includes/link-template.php:
    get_avatar_data()
  • wp-admin/custom-background.php:
    Custom_Background::ajax_background_add()
  • wp-admin/includes/class-wp-list-table.php:
    WP_List_Table::get_pagenum()
  • wp-admin/includes/misc.php:
    wp_check_locked_posts()
  • wp-admin/includes/misc.php:
    wp_refresh_post_lock()
  • wp-admin/includes/misc.php:
    wp_refresh_post_nonces()
  • wp-admin/includes/dashboard.php:
    wp_dashboard()
  • wp-admin/includes/media.php:
    get_media_item()
  • wp-admin/includes/media.php:
    media_upload_form()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_save_attachment_order()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_get_attachment()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_save_attachment()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_save_attachment_compat()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_wp_link_ajax()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_get_comments()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_replyto_comment()
  • wp-admin/includes/revision.php:
    wp_prepare_revisions_for_js()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_autocomplete_user()
  • 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()
  • wp-admin/includes/nav-menu.php:
    wp_nav_menu_item_post_type_meta_box()
  • wp-admin/includes/nav-menu.php:
    wp_nav_menu_item_taxonomy_meta_box()
  • wp-admin/includes/comment.php:
    get_pending_comments_num()
  • wp-admin/custom-header.php:
    Custom_Image_Header::get_header_dimensions()
  • wp-admin/custom-header.php:
    Custom_Image_Header::ajax_header_crop()
  • wp-admin/custom-header.php:
    Custom_Image_Header::ajax_header_add()
  • wp-admin/custom-header.php:
    Custom_Image_Header::ajax_header_remove()
  • wp-admin/custom-header.php:
    Custom_Image_Header::step_2()
  • wp-admin/custom-header.php:
    Custom_Image_Header::step_3()
  • wp-admin/custom-header.php:
    Custom_Image_Header::js_2()
  • wp-admin/custom-background.php:
    Custom_Background::wp_set_background_image()
  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::register_controls()
  • wp-includes/formatting.php:
    sanitize_option()
  • wp-includes/pluggable.php:
    wp_rand()
  • wp-includes/general-template.php:
    wp_get_archives()
  • wp-includes/class-wp-query.php:
    WP_Query::get_posts()
  • wp-includes/class-wp-query.php:
    WP_Query::parse_query()
  • wp-includes/class-wp-query.php:
    WP_Query::parse_tax_query()
  • wp-includes/load.php:
    get_current_blog_id()
  • wp-includes/functions.php:
    get_status_header_desc()
  • wp-includes/functions.php:
    number_format_i18n()
  • wp-includes/widgets/class-wp-widget-recent-comments.php:
    WP_Widget_Recent_Comments::update()
  • wp-includes/widgets/class-wp-widget-recent-comments.php:
    WP_Widget_Recent_Comments::form()
  • wp-includes/widgets/class-wp-widget-recent-posts.php:
    WP_Widget_Recent_Posts::widget()
  • wp-includes/widgets/class-wp-widget-recent-posts.php:
    WP_Widget_Recent_Posts::form()
  • wp-includes/widgets/class-wp-widget-recent-comments.php:
    WP_Widget_Recent_Comments::widget()
  • wp-includes/link-template.php:
    get_post_comments_feed_link()
  • wp-includes/class-wp-user-query.php:
    WP_User_Query::prepare_query()
  • wp-includes/media.php:
    wp_video_shortcode()
  • wp-includes/media.php:
    wp_get_attachment_image()
  • wp-includes/media.php:
    add_image_size()
  • wp-includes/post.php:
    set_post_thumbnail()
  • wp-includes/post.php:
    wp_get_recent_posts()
  • wp-includes/post.php:
    is_sticky()
  • wp-includes/post.php:
    get_post_custom()
  • wp-includes/rewrite.php:
    url_to_postid()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::mw_getRecentPosts()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::mt_getRecentPostTitles()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::blogger_getRecentPosts()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getMediaLibrary()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getComments()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_newComment()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getPosts()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getTerms()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getUsers()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::_insert_post()
  • 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()
  • wp-includes/meta.php:
    delete_metadata()
  • wp-includes/meta.php:
    get_metadata()
  • wp-includes/meta.php:
    metadata_exists()
  • wp-includes/class-wp-editor.php:
    _WP_Editors::wp_link_query()
  • wp-includes/meta.php:
    add_metadata()
  • wp-includes/meta.php:
    update_metadata()

使用举例

当传递一个负整数时,将得到非负绝对值。传递非数字字符串返回 0,但传递 -10 返回 10:

echo absint( 'number' );		// 0
echo absint( 10 );				// 10
echo absint( -10 );				// 10

传递浮点数时,它将返回整数值。

echo absint(20.33);            // 20
echo absint(-20.33);           // 20
echo absint(false);            // 0
echo absint(true);             // 1
echo absint(array(10,20,30))   // 1
echo absint(NULL)              // 0

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈