I need to be able to format data.
Printf() is perfect because I need a certain amount of characters (30
for address).
However I need this formatted data to be inside a file that's fwrite()
and then FTPed to a distributor who will parse it and input into their
database.
printf("% 4d",$ord
Absolutely nothing wrong with that solution. But here is an alternative
just for fun:
for($letters = range('A','Z'), $i=0; isset($letters{$i}); $i++)
echo $letters{$i}." ";
-Rasmus
Miguel Guirao wrote:
> Thanks!!
>
> I think the ord() function should receive an integer as a parameter and it
nope
chr ( int ascii ) takes the integer
ord ( string string ) takes the string
bastien
From: Miguel Guirao <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: RE: [PHP-DB] Letters loop
Date: Thu, 26 May 2005 09:22:56 -0500
Thanks!!
I think the ord() function should receive an integer as
This a better and small aproach!!!
Thanks!!!
-Original Message-
From: Neil Smith [MVP, Digital media]
[mailto:[EMAIL PROTECTED]
Sent: Jueves, 26 de Mayo de 2005 07:35 a.m.
To: php-db@lists.php.net
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] RE : Subject: Letters loop
for ($i=1; $i<=26; $i++)
Thanks!!
I think the ord() function should receive an integer as a parameter and it
returns it's corresponding character.
But it will work!!!
-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Jueves, 26 de Mayo de 2005 08:28 a.m.
To: [EMAIL PROTECTED]; php-db@lists.ph
try
for ($i =ord( 'A'); $i <= ord('Z'); $i++){
// code
}
bastien
From: MIGUEL ANTONIO GUIRAO AGUILAR <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: [PHP-DB] Letters loop
Date: Wed, 25 May 2005 20:37:47 -0700
Hi!!
I wanna a do a for loop with letters, Is this possible?
for ($i = 'A';
for ($i=1; $i<=26; $i++) {
print(chr(64+$i));
}
chr() prints the ASCII character corresponding to that number.
Upper case A-Z starts at 64 : http://www.lookuptables.com
Cheers - Neil
Date: Wed, 25 May 2005 20:37:47 -0700
From: MIGUEL ANTONIO GUIRAO AGUILAR <[EMAIL PROTECTED]>
To: php-d
Message-Id: <[EMAIL PROTECTED]>
From: "Chris Payne" <[EMAIL PROTECTED]>
To:
Date: Wed, 25 May 2005 00:53:59 -0400
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="=_NextPart_000__01C560C4.3CC5A710"
Subject: Form information
Hi there everyone,
I'm pulling data f
MIGUEL ANTONIO GUIRAO AGUILAR wrote:
Hi!!
I wanna a do a for loop with letters, Is this possible?
for ($i = 'A'; $i <= 'Z'; $i++){
// code
}
try it.
php -r '
for ($i = "a"; $i < "z"; $i++){ echo $i,"."; } echo "z";'
--
MIGUEL GUIRAO AGUILERA
Logistica R8 - Telcel