Re: [PHP] str_pad with nbsp;
On Sun, 31 Oct 2004 16:13:44 -0600, Jonel Rienton [EMAIL PROTECTED] wrote: i was trying to do an str_pad with nbsp; (space) but somehow it's just putting in one space and nbs sample code: ? echo str_pad($varname,20,nbsp; ? anybody else experienced this? nbsp; is 6 characters. It may only appear as one character when viewed as html, but to str_pad() it's 6 characters. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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 [EMAIL PROTECTED] To: php [EMAIL PROTECTED] 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
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:[EMAIL PROTECTED] 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 [EMAIL PROTECTED] To: php [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] str_pad
On Fri, 2003-09-26 at 11:00, Jeff McKeon wrote: 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? $line is an instance of some class (not shown in the above). dbranch is a member variable of the class, and subsequently an instance variable of the object $line. The - is how you access methods and variables in objects. HTH, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] str_pad
No, $line is an object (class instance) and dbranch_no is a property of the object. www.php.net/oop Jeff McKeon wrote: 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:[EMAIL PROTECTED] 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 [EMAIL PROTECTED] To: php [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] str_pad
On Fri, 2003-09-26 at 11:18, Robert Cummings wrote: On Fri, 2003-09-26 at 11:00, Jeff McKeon wrote: 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? $line is an instance of some class (not shown in the above). dbranch is Should say dbranch_no 8) a member variable of the class, and subsequently an instance variable of the object $line. The - is how you access methods and variables in objects. HTH, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] str_pad
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 [EMAIL PROTECTED] To: Nitin [EMAIL PROTECTED]; Chris Grigor [EMAIL PROTECTED]; php [EMAIL PROTECTED] 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:[EMAIL PROTECTED] 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 [EMAIL PROTECTED] To: php [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] str_pad
Thanks all! This is definitely one of the most helpfull mailing lists I belong to. Jeff -Original Message- From: Nitin [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 11:26 AM To: Jeff McKeon; php Subject: Re: [PHP] str_pad 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 [EMAIL PROTECTED] To: Nitin [EMAIL PROTECTED]; Chris Grigor [EMAIL PROTECTED]; php [EMAIL PROTECTED] 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:[EMAIL PROTECTED] 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 [EMAIL PROTECTED] To: php [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php