[wp-trac] Re: [WordPress Trac] #9079: Documentation correction: absint()

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 10 15:15:09 GMT 2009


#9079: Documentation correction: absint()
--------------------------------------+-------------------------------------
 Reporter:  mdawaffe                  |        Owner:  mdawaffe
     Type:  defect (bug)              |       Status:  assigned
 Priority:  normal                    |    Milestone:  2.8     
Component:  General                   |      Version:  2.7     
 Severity:  minor                     |   Resolution:          
 Keywords:  documentation, has-patch  |  
--------------------------------------+-------------------------------------
Comment (by azaozz):

 Wouldn't it be clearer to use the "math" language there: "Converts value
 to absolute integer."

 Looking at how this is used, perhaps we need something different there.
 Currently `absint(100)` returns 100, `absint(-100)` returns 100 too but is
 used to filter various db IDs where -100 is an invalid value. Perhaps we
 need something like:
 {{{
 function absint( $maybeint ) {
   if ( intval( $maybeint ) < 1 )
     return 0;

   return intval( $maybeint );
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/9079#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list