Re: str_pad

From: Date: Fri, 26 Sep 2003 15:26:20 +0000
Subject: Re: str_pad
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-164048@lists.php.net to get a copy of this message
It gives dbranch_no field in $line array "$line->dbranch_no" replaces the value of 'dbranch_no' field stored in '$line' array. Enjoy Nitin ----- Original Message ----- From: "Jeff McKeon" <jmckeon@telaurus.com> To: "Nitin" <nitinmehta@kappa.net.in>; "Chris Grigor" <aphrodit@iafrica.com>; "php" <php-general@lists.php.net> Sent: Friday, September 26, 2003 8:30 PM Subject: RE: [PHP] str_pad > Just learning PHP and figuring out all the syntax and stuff. Anyway I > had a question about the code example in this post... > > What does the "->" do in: > > $dbranch = str_pad($line->dbranch_no, 6, '', STR_PAD_LEFT); > > Is dbranch_no a "class" I don't know about? > > Thanks, > > Jeff > > > > -----Original Message----- > > From: Nitin [mailto:nitinmehta@kappa.net.in] > > Sent: Friday, September 26, 2003 8:05 AM > > To: Chris Grigor; php > > Subject: Re: [PHP] str_pad > > > > > > of course, you can specify the optional argument STR_PAD_LEFT like: > > > > $dbranch = str_pad($line->dbranch_no, 6, '', STR_PAD_LEFT); > > > > Enjoy, > > Nitin > > > > > > ----- Original Message ----- > > From: "Chris Grigor" <aphrodit@iafrica.com> > > To: "php" <php-general@lists.php.net> > > Sent: Friday, September 26, 2003 4:49 PM > > Subject: [PHP] str_pad > > > > > > This should be quite an easy task for some... > > > > say for example $line->dbranch has a value of 3 > > I know that 3 spaces will be added on to the end of $dbranch > > > > > > $dbranch = str_pad($line->dbranch_no, 6); > > > > so the value of $dbranch should look like "3 " > > > > Is there anyway to right justify the 3 using str_pad .. > > example still put the 3 spaces in but at the beginning??? > > so it looks like " 3" > > > > > > Chris > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

« previous php.general (#164048) next »