RE: ASPs cSTR function, WTF??!!!

From: Date: Wed, 02 May 2001 09:01:41 +0000
Subject: RE: ASPs cSTR function, WTF??!!!
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-7197@lists.php.net to get a copy of this message
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:r.gelstharp@ntlworld.com] Sent: Wednesday, 2 May 2001 1:55 AM To: php-windows@lists.php.net 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

« previous php.windows (#7197) next »