The correct case should be CStr, the same as CInt
It is used for typecasting, but obviously Strings should not be used if you
can avoid it, because they are SLOW.
The PHP equivalent is to write:
function selected (&$firstval, &$secondval) {
return (strcmp($firstval, $secondval) == 0) ? " SELECTED " : "";
}
This would typecast the inputs to type "string".
Alternatively, you can also do it this way (this is a type-insensitive
match):
function selected (&$firstval, &$secondval) {
return ( $firstval == $secondval ) ? (" SELECTED ") : ("");
}
You need to typecast to string only when you use the type-sensitive match:
function selected (&$firstval, &$secondval) {
return ( "$firstval" === "$secondval" ) ? (" SELECTED ") : ("");
}
-----Original Message-----
From: r.gelstharp [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 2 May 2001 1:55 AM
To: [EMAIL PROTECTED]
Subject: ASPs cSTR function, WTF??!!!
In the attempt at trying to convert my ASP pages to PHP, I've run across a
little include file that contains a number of functions.
this is the function I'm trying to emulate :-
FUNCTION SELECTED( firstVal, secondVal )
IF cSTR( firstVal ) = cSTR( secondVal ) THEN
SELECTED = " SELECTED "
ELSE
SELECTED = ""
END IF
END FUNCTION
does anyone know what this cSTR function is and what it does? Furthermore,
is there a PHP equivalent?
Many thanks,
Matt Bridger
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]