php.js

in Develop

嗯,这个标题没有错。

以前有个同事写了个asp版的Cute ASP Framework,封装了一些很实用的函数。

后来我们谈到php中的一些内置函数,他也曾有过将其翻译成asp版的想法。

没想到,有人居然把php中内置的函数直接翻成了js。

如php中的strcmp,JS版的:

function strcmp ( str1, str2 ) {
// Binary safe string comparison
//
// version: 812.316
// discuss at: http://phpjs.org/functions/strcmp
// +   original by: Waldo Malqui Silva
// +      input by: Steve Hilder
// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// +    revised by: gorthaur
// *     example 1: strcmp( 'waldo', 'owald' );
// *     returns 1: 1
// *     example 2: strcmp( 'owald', 'waldo' );
// *     returns 2: -1
return ( ( str1 == str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) );
}

看这里:

http://phpjs.org/functions/index

这个太NB了。

6 Comments

6 Comments

  1. 好工具。
    好教程。

    恭喜Blog转型成功。

  2. 是不是不小心把我的网址去掉了呀?呵呵 :o

  3. 的确是非常有用的函数呵

  4. 这个确实很 NB,呵呵!
    看来我是不是得写个 as.js,哈哈!~

  5. 在我眼中懂这些的都是NB,那些PHP,JS,ASP我完全不懂。

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>