phpjs
Version:
74 lines (62 loc) • 1.88 kB
HTML
<!-- Generated by Rakefile:build -->
<strong>
<a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a>
</strong>
on 2008-10-06 12:08:20 <br />
@ Onno Marsman: Processed. Thank you!
<hr />
<strong>
Onno Marsman
</strong>
on 2008-10-04 17:41:10 <br />
Improved to accept things other than strings. Also &quot;if(f_offset == undefined) {&quot; seemed useless since indexOf accepts undefined as a 0 anyway. Also changed &gt; -1 to !== -1, to increase performance a tiny bit.
<pre><code>
function stripos ( f_haystack, f_needle, f_offset ) {
var haystack = (f_haystack+'').toLowerCase();
var needle = (f_needle+'').toLowerCase();
var index = 0;
if ((index = haystack.indexOf(needle, f_offset)) !== -1) {
return index;
}
return false;
}
</code></pre>
<hr />
<strong>
<a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a>
</strong>
on 2008-03-07 19:29:30 <br />
@ Thiago Mata: Thanks alot, I've added the function!
<hr />
<strong>
call_user_func_array
</strong>
on 2008-03-07 15:15:15 <br />
<pre><code>
/**
* @author Thiago Mata
* @date 07/03/2008
* @param callback strFunctionName
* @param array arrParam
* @return mixer
* @url thiagomata.blog.com
*/
function call_user_func_array( strFunctionName , arrParam )
{
var strCommand = &quot;&quot;;
var i;
strCommand += &quot;return &quot; + strFunctionName + &quot;(&quot;;
for( i = 0; i &lt; arrParam.length; ++i )
{
strCommand += &quot;arrParam[&quot; + i + &quot;]&quot; ;
if( ( i + 1 ) != arrParam.length )
{
strCommand += &quot;,&quot;;
}
}
strCommand += &quot;)&quot;;
var oFunction = new Function( &quot;arrParam&quot; , strCommand );
return oFunction( arrParam );
}
</code></pre>
<hr />