Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <36040878.qUTcmyb4oS@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 16 May 2013 05:00:30 +0200 User-Agent: KNode/4.10.2 Content-Transfer-Encoding: 7Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <5190d3a0$0$15991$e4fe514c@news2.news.xs4all.nl> <9869380.OEKH2unXeN@PointedEars.de> <1934679.jXLOkI38UW@PointedEars.de> MIME-Version: 1.0 Lines: 43 NNTP-Posting-Date: 16 May 2013 05:00:31 CEST NNTP-Posting-Host: af46f32b.newsspool4.arcor-online.net X-Trace: DXC=b:a_4gXV0MhPXlQ;h]GTMd4IUK Thomas Mlynarczyk wrote: >> Christoph Becker schrieb: >>> ACK. However, the usefulness of is_numeric() returning true for strings >>> in binary notation is somewhat doubtful, as there is no simple way to >>> actually convert such strings to a number: >>> >>> >>> (int) '0b1010' >>> 0 >>> >>> intval('0b1010') >>> 0 >>> >>> intval('0b1010', 2) >>> 0 >>> >>> 0 + '0b1010' >>> 0 >> >> bindec( '0b1010' ) > > Nice -- thanks for pointing it out. :) ACK. > But what's that: > > php -r "var_dump(bindec('foo1010bar'));" > int(10) > > It seems bindec() ignores any leading and trailing characters that are > neither 0 or 1. > > So, bindec() doesn't seem to be useful for a routine, which would ^ > convert an arbitrary numeric string to an integer. True. But, on the other hand, it is not supposed to. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, (2004)