I have in my mind what I need to do to make the arg value available to all of the included functions that I am pulling into this script. As I am fairly new with the concept of functions, I am a bit lost as to why this doesn't work as I am thinking it would.
I am calling this script and passing an arguement at commandline. In this case I will use:
php mode_set.php test
I first tried setting a variable for the arguement value:
$mode = $argv[1];
and just referencing the value; however, I quickly learned that it wouldn't be available to other functions.
This led me to realize that in order for it to be available to other functions, I needed to create a function for it:
<?php
$mode = $argv[1];
//Returns the Mode Value
function show_mode()
{
if($mode == "test")
{
return "test";
}
elseif($mode == "parse")
{
return "parse";
}
else
{
return "false";
}
}
if(show_mode() == "test")
{
Do something useful...not working.
}
?>
What I am getting is it seems to be ignoring the arguement, and instead always passes false.