I have the following VBScript code, which I'm converting to PHP:
result = MyLibrary.InitSLibLibrary(cstr(LicsKey))
ScannerErrorAlert result
Can anyone tell me the PHP equivalent of the CStr
function used in this code?
I have the following VBScript code, which I'm converting to PHP:
result = MyLibrary.InitSLibLibrary(cstr(LicsKey))
ScannerErrorAlert result
Can anyone tell me the PHP equivalent of the CStr
function used in this code?
I'm not that familiar with VBScript, but a quick search shows that CStr() converts non-string values to strings.
The most direct equivalent would be the strval() function, which has the same syntax as CStr(). Alternatively, you can do a simple cast:
$myString = (string)$myInteger;
You can also convert objects in this way if they define the __toString() method. For more details, see:
http://us.php.net/manual/en/language.types.string.php#language.types.string.casting
Having said all that, you typically don't need to worry about this, as PHP, being a loosely-typed language, generally handles type juggling quite well without explicit conversions. Try simply using the variable without explicitly converting it, and it may very well work.