I haven’t quite got the hang of functions yet,
I’ve gotten too spoiled of using include() and
placing what I need in a different file.
I’m at a place now where I need everything on one page,
so I need to do a function().
What I’ve tried, I can’t get it to work…
Here is a sample code:
[code=php]
// if count stronger = 0 retrieve the first two items in weaker
if($count_stronger == 0)
{
$weakerpairs = $weaker[0].$weaker[1];
$whichpair = $weakerpairs;
// /////////////////////////////////
// /////////////////////////////////
include(“testpair.php”);
// ////////////////////////////////
// ////////////////////////////////
}
a portion of testpair.php is:
[code=php]
<?php
switch($whichpair){
case “EURUSD” : $testpair = “eurusd”; break;
case “USDEUR” : $testpair = “eurusd”; break;
case “EURGBP” : $testpair = “eurgbp”; break;
…
…
}
?>
I made a few attempts to turn ” testpair.php ” into a function
at the beginning of the code:
[code=php]
<?php
function (testpair){
switch($whichpair){
case “EURUSD” : $testpair = “eurusd”; break;
case “USDEUR” : $testpair = “eurusd”; break;
case “EURGBP” : $testpair = “eurgbp”; break;
…
…
}
}
?>
…code…
…code…
// if count stronger = 0 retrieve the first two items in weaker
if($count_stronger == 0)
{
$weakerpairs = $weaker[0].$weaker[1];
$whichpair = $weakerpairs;
// /////////////////////////////////
// /////////////////////////////////
testpair();
// ////////////////////////////////
// ////////////////////////////////
}
I’ve tried to navigate through php.net and I can’t seem to find a simple answer.
I have the Sams Teach yourself php and it doesn’t have a simple answer.
Classes, Objects la la la. Gee, all I want is a simple function().