RE: [PHP] Coding hints?
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Wed, 08 Nov 2000 02:37:32 +0000 |
| Subject: | RE: [PHP] Coding hints? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24242@lists.php.net to get a copy of this message | ||
Its a cast to an int
where does $sb get its value from?
You can put anything in $sb, by default its a string.
Eg
If you have a2 in $sb
then
$arr = file('sb' . $sb . '.src');
will be
sbs2.src
-----Original Message-----
From: Gavster [mailto:gavster@offbeatmedia.com]
Sent: November 8, 2000 10:34 AM
To: php-general@lists.php.net
Subject: [PHP] Coding hints?
Hi Guys,
Sorry to post with something trivial, but I can't seem to find anything on
this:
I'm modifying some code to recognize a certain filename scheme, but I've
run across something I've never seen before.
Here's the code:
$arr = file('sb' .(int)$sb. '.src');
The filename it's looking for is in the form sbN.src (where N = an integer).
The $sb variable is an integer passed via the url.
What I don't get is the (int)$sb part - what is the (int) doing there? Is
this some sort of funky regex? Or is it casting the $sb string into an
int? I must admit, I'm at a loss . . .
What I'm ultimately trying to do is to get the code to recognize files
where $sb is not only a number, but is also a number with a single char
appended to it such as [a-z]. Can't this be done with a straightforward
regex?
Any pointers would be greatly appreciated . . . =0)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net