PDA

View Full Version : My Most Useless Php Function



Jonathan
05-23-2006, 07:10 PM
function ident($spaces = 3, $char = " ") {
while ( $position < $spaces) {
$rtn .= $char;
$position++;
}
return $rtn;
}


when called, it returns the second parameter x amount of times (let x = first param)

Basically if i did

<? echo ident(2); ?>

it would return two spaces... Kind of useful if you don&#39;t want to get lost in a horde of <blockquote>s

Here is a real-life application of my function, as used on team357.org



echo ident&#40;3&#41; . &#34;Adding to mySQL Database Server&#60;br /&#62;&#092;n&#34;;
&#036;insertquery=mysql_query2&#40;&#34;INSERT INTO &#96;udhs_gal_cats&#96; &#40;&#96;ID&#96;, &#96;name&#96;, &#96;parent&#96;, &#96;dir&#96;, &#96;addedby&#96;&#41; VALUES&#40;&#39;&#39;, &#39;&#036;file&#39;, &#39;&#036;category&#39;, &#39;&#036;filtered_path&#39; , &#39;&#036;uinfo_userid&#39;&#41;&#34;&#41;;
echo ident&#40;6&#41; . &#34;mySQL Database Updated&#60;br /&#62;&#092;n&#34;;

echo ident&#40;3&#41; . &#34;Renaming Folder to &#60;i&#62;&#036;file_filtered&#60;/i&#62;&#60;br /&#62;&#092;n&#34;;
&#036;rename = rename&#40;&#036;pre_path, &#036;filtered_path&#41;;
echo ident&#40;6&#41; . &#34;Rename Successful&#60;br /&#62;&#092;n&#34;;
echo ident&#40;6&#41; . &#34;Restored Permissions&#60;br /&#62;&#092;n&#34;;
system&#40;&#34;chgrp team357 &#036;file&#34;, &#036;chgr2&#41;;

napoleon
05-29-2006, 11:24 AM
I think you meant to spell it as.. indent...

Jonathan
05-29-2006, 11:30 AM
<div class='quotetop'>QUOTE(Spencer &#064; May 29 2006, 10&#58;24 AM) 324</div>

I think you meant to spell it as.. indent...
[/b]

Yes I did. Ident is a habit when typing a &#39;convience shortcut&#39; to identify commands :P

Cynagen
06-26-2006, 05:09 PM
<div class='quotetop'>QUOTE(Jonathan &#064; May 29 2006, 07&#58;30 AM) 325</div>

Yes I did. Ident is a habit when typing a &#39;convience shortcut&#39; to identify commands :P
[/b]

dent("Knippy&#39;s head", 500);

Usage: dent(&#036;var_to_dent=NULL, &#036;times_to_dent=10);

Jonathan
06-26-2006, 06:41 PM
Gosh, you are so damn mean to me, ya know.

Cynagen
06-26-2006, 07:11 PM
<div class='quotetop'>QUOTE(Jonathan &#064; Jun 26 2006, 02&#58;41 PM) 462</div>

Gosh, you are so damn mean to me, ya know.
[/b]

Bish you know you love it.

Jonathan
06-26-2006, 07:18 PM
You just just how I like it ;)