Function declaration
From kwiki
| | This article is written by Konrad, thus using rather nonstandard English:) |
Syntax
ReturnValue FunctionName (ParamType Param);
or:
ReturnValue FunctionName (ParamType Param,[ParamType OptionalParam]);
Example I
int strlen(string Str)
This means, that function strlen takes one param (Str) of type string, and returns int Usage :
var $nLen=strlen("Some string");//$nLen is now 11
var $nLen=strlen($SomeStringVar);
Example II
bool ShellExecute (string strOperation,string strPath,[string strParams],[string strDir]);
This means, that function ShellExecute takes two mandatory parameters, both of type string (strOperation, and strPath), and two optional parameters (strParams and strDir), also of type string. Function returns bool (TRUE or FALSE, indicating fail or success). Usage:
var $bSucceeded=ShellExecute("","C:\\Windows\\Notepad.exe");
This will open 'Notepad' application, and if succeeded '$bSucceeded' variable will be equal to 1 (TRUE).
Example III'
int strfind (string str,string strToFind,int startFrom,[ bool IgnoringCase=FALSE]);
Three mandatory params (str,strToFind,startFrom), and one optional - if omitted will be assumed to be FALSE.
More examples
string array_info (array_var var);
function array_info takes one parameter of type array (of anything) and returns string
string var_type(any_var var);
function var_type takes one parameter of any type and returns string
double sqrt (numerical);
function sqrt takes one parameter of numerical type (int or double) and returns double
int SendMessage(HWND hWnd,int Msg,[int wParam],[int lParam]);
function SendMessage takes two mandatory parameters, one of them, HWND is a pseudo type (in reality it's int)
