Re: Coding hints?

From: Date: Wed, 08 Nov 2000 02:34:58 +0000
Subject: Re: Coding hints?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24241@lists.php.net to get a copy of this message
The (int) is called TYPE CASTING. This part of PHP was inherited from C. It is forcing the value out of the variable to be an integer (whether or not you get what you expect). -jeremy brand http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more --------------------------------------------------------------------- We cannot do everything at once, but we can do something at once. -- Calvin Coolidge On Tue, 7 Nov 2000, Gavster wrote: > Date: Tue, 07 Nov 2000 18:33:48 -0800 > From: Gavster <gavster@offbeatmedia.com> > 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 > >

« previous php.general (#24241) next »