At 11/14/05 10:01 PM, Greeley wrote: I still need to understand strings, arrays, and some functions abit more. I'll understand it all over time.
Strings are one of the most simple concepts a human can comprehend. Since PHP doesn't have a method of discerning between single characters (char) and multi-character strings (string) then everything that contains quotes is a string. Well, that's a nice general rule to use.
You know, in C/C++ 'b' is a char while "hello" is a string.
Arrays are pretty easy also. Using predefined functions isn't much different than using simple constructs such as echo. If you're building your own functions I find it a lot simpler than building them in other languages such as C/C++.
In php, while defining your own function there is no return type that must be specified; however, I also make a note showing the return type so I know how to use the function in later programs.
If you're used to a C language you can think of the function keyword as the return type. You declare a function in php like this:
function func_name(argument list) {
function code
}
Here is a basic function that just renames echo to show_output and turns the construct into a function which an optional return parameter.
function show_output($string, $return = 1) {
if ($return == 0) {
return$string;
} else {
echo $string;
}
}
Okay, this is a nice feature because we can have a void return type if the statement is echoed or we can have a string return type if return is set to false.
Earn real money by betting and investing; or, sponsor, challenge, compete,
recruit, communicate, network, earn money playing games, and much more.