RunPHP – is there a specific way to write a function when using that plugin
-
Hello,
RunPHP runs fine for me except when i’m calling a function. so, i suppose it’s my way to write the function that is no good. though, it works outside of RunPHP (the eval thing) so i was wondering if there were specific tricks to have a function work.
Thnks for your help
-
Not that I could answer the question–but try posting the code for that function here in backticks. Also might want error messages, if any, you’re seeing.
<?php
function hello() {
echo "Hello";
}
function world() {
echo "World";
}
hello();
world();
echo "<br/>Goodbye<br/>";
?>Within a post worked fine. All the functions are self-contained in that post. If you are calling functions externally, you’d presumably have to do some “include()”‘s…
Regards
here’s the function, not quite beautiful, i still wish to refine it,
<?php
function abc () {
global $chaine, $width;
$chaine = strtolower($chaine);
for ($i=0; $i < strlen($chaine); $i++)
{
if (substr($chaine,$i,1) == " ") echo "<img src='/to-be-or/img/shim.gif' border='0' width='$width' height='5'>";
elseif (substr($chaine,$i,1) == ";") echo "; ";
elseif (substr($chaine,$i,1) == ",") echo ", ";
elseif (substr($chaine,$i,1) == ".") echo ". ";
elseif (substr($chaine,$i,1) == "!") echo "! ";
elseif (substr($chaine,$i,1) == "’") echo "’";
elseif (substr($chaine,$i,1) == "'") echo "'";
elseif (substr($chaine,$i,1) == "-") echo "-";
elseif (substr($chaine,$i,1) == "*") echo "*";
elseif (substr($chaine,$i,1) == "\"") echo "\"";
elseif (substr($chaine,$i,1) == "?") echo "?";
elseif (substr($chaine,$i,1) == "(") echo "(";
elseif (substr($chaine,$i,1) == ")") echo ")";
elseif (substr($chaine,$i,1) == "\n") echo "<br>\n\n";
elseif (substr($chaine,$i,1) == "a") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='26'>";
elseif (substr($chaine,$i,1) == "Ã ") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='26'>";
elseif (substr($chaine,$i,1) == "â") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='26'>";
elseif (substr($chaine,$i,1) == "b") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='25'>";
elseif (substr($chaine,$i,1) == "c") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='24'>";
elseif (substr($chaine,$i,1) == "ç") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='23'>";
elseif (substr($chaine,$i,1) == "d") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='22'>";
elseif (substr($chaine,$i,1) == "é") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='22'>";
elseif (substr($chaine,$i,1) == "è") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='22'>";
elseif (substr($chaine,$i,1) == "ê") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='22'>";
elseif (substr($chaine,$i,1) == "e") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='22'>";
elseif (substr($chaine,$i,1) == "f") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='21'>";
elseif (substr($chaine,$i,1) == "g") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='20'>";
elseif (substr($chaine,$i,1) == "h") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='19'>";
elseif (substr($chaine,$i,1) == "i") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='18'>";
elseif (substr($chaine,$i,1) == "î") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='18'>";
elseif (substr($chaine,$i,1) == "ï") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='18'>";
elseif (substr($chaine,$i,1) == "j") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='17'>";
elseif (substr($chaine,$i,1) == "k") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='16'>";
elseif (substr($chaine,$i,1) == "l") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='15'>";
elseif (substr($chaine,$i,1) == "m") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='14'>";
elseif (substr($chaine,$i,1) == "n") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='13'>";
elseif (substr($chaine,$i,1) == "o") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='12'>";
elseif (substr($chaine,$i,1) == "ô") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='12'>";
elseif (substr($chaine,$i,1) == "p") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='11'>";
elseif (substr($chaine,$i,1) == "q") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='10'>";
elseif (substr($chaine,$i,1) == "r") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='9'>";
elseif (substr($chaine,$i,1) == "s") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='7'>";
elseif (substr($chaine,$i,1) == "t") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='7'>";
elseif (substr($chaine,$i,1) == "u") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='6'>";
elseif (substr($chaine,$i,1) == "ù") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='6'>";
elseif (substr($chaine,$i,1) == "ü") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='6'>";
elseif (substr($chaine,$i,1) == "û") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='6'>";
elseif (substr($chaine,$i,1) == "v") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='4'>";
elseif (substr($chaine,$i,1) == "w") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='4'>";
elseif (substr($chaine,$i,1) == "x") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='3'>";
elseif (substr($chaine,$i,1) == "y") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='2'>";
elseif (substr($chaine,$i,1) == "z") echo "<img src='/to-be-or/img/noir.gif' border='0' width='$width' height='1'>";
}
}
?>
i try to put it within an include as well as within the post, no success
but it worked outside of the function
thanks a lot
The topic ‘RunPHP – is there a specific way to write a function when using that plugin’ is closed to new replies.