UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

91 lines (70 loc) 3.46 kB
<!-- Generated by Rakefile:build --> <strong> <a href="http://an3m1.com/" rel="nofollow">????? ?????? ? ?????</a> </strong> on 2012-04-18 10:19:11 <br /> I wonder how you got so good. HaHa ! This is really a fascinating blog, lots of stuff that I can get into. One thing I just want to say is that your design is so perfect ! You certainly know how to get a girls attention ! I’m glad that you’re here. I feel like I’ve learned something new by being here <hr /> <strong> Rafa? Kukawski </strong> on 2011-06-30 16:33:32 <br /> @dude: Math.floor(value) !== value|value floor(-10.5) === -11 (-10.5|-10.5) === -10 Your approach is only valid for positive numbers. <hr /> <strong> dude </strong> on 2011-06-30 15:36:32 <br /> again... DO IT RIGHT!!! return value|value <hr /> <strong> <a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a> </strong> on 2011-02-18 04:25:05 <br /> @ejrdtykufg: Good joke, but if you weren't aware of the site's purpose, read the comments below yours. <hr /> <strong> ejrdtykufg </strong> on 2011-02-17 15:58:23 <br /> Please add author's portrait to this function! <hr /> <strong> <a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a> </strong> on 2010-12-09 04:31:21 <br /> @Andrew: Yes, that works well, but 1) We're following the same functional format for the sake of familiarity to our users (and possibly also simplicity in our compiler). 2) All our functions can be used not only in a non-namespaced environment, but also in a namespaced one (which I know could be done by &quot;floor: Math.floor&quot; if the compiler were aware of this format). Granted, in that case, one may just as well use Math.floor directly, but as we describe somewhere in our FAQ or site, some functions are implemented just for the sake of students of JavaScript (coming from PHP backgrounds) or for those still just functioning as script kiddies who are rushing to put something together that works, and who haven't taken time yet to learn the details of the language they will hopefully eventually learn more deeply. That being said, the large majority of functions in php.js are not and cannot be mere wrappers for the limited utility set built into JavaScript since PHP is far more expressive as far as built-in utilities. <hr /> <strong> Andrew </strong> on 2010-12-09 02:08:16 <br /> Why don't you just have <pre><code> floor = Math.floor; </code></pre> Has the same functionality and it's marginally faster in all browsers too, since it bypasses the encumbered 'Math' object. <hr /> <strong> <a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a> </strong> on 2010-09-08 19:48:24 <br /> @ Mogria: This can also be used as a learning reference for PHP folks trying to learn JavaScript. Besides this opens up all kinds of opportunities like the Harmony Framework <hr /> <strong> <a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a> </strong> on 2010-09-06 12:44:33 <br /> @Mogria: You can and probably should just use Math.floor. We are trying to fully implement the PHP API, both for the sake of convenience of those familiar with PHP and moving to JavaScript, and for the sake of (usually) offering convenient features that do not always map one-to-one to a built-in JavaScript function as this one does. <hr /> <strong> Mogria </strong> on 2010-09-05 16:37:25 <br /> I think this function is unnecessary. Why you don't use &quot;Math.floor&quot; ... <hr />