Re: excel macro into php
| From: | Richard Lynch | Date: | Thu, 03 May 2007 16:07:07 +0000 |
| Subject: | Re: excel macro into php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254352@lists.php.net to get a copy of this message | ||
On Thu, May 3, 2007 4:37 am, Tijnema ! wrote:
> On 5/2/07, Anton Krall <akrall-lists@intruder.com.mx> wrote:
>> Guys.. I have a problem and I was wondering if somebody with good
>> php
>> knowledge could help.
>>
>> I have this excel macro that converts number currency (mexican) into
>> a
>> string and I was wondering if somebody could help translating it to
>> php...
>>
>> Her eis the macro, if you could help, I would really appreciate it.
>>
>> Thanks guys!
>
> I think that starting over is better then trying to convert this excel
> macro. What exactly do you want to convert, from ?? to ??
> Since all functions are in a language that isn't english, dutch,
> german or frisian, I can't understand.
>>
> <snip>
>> laUnidades = Array("UN", "DOS", "TRES", "CUATRO",
>> "CINCO", "SEIS",
>> "SIETE",
>> "OCHO", "NUEVE", "DIEZ", "ONCE", "DOCE",
>> "TRECE", "CATORCE",
>> "QUINCE",
>> "DIESISEIS", "DIESISIETE", "DIESIOCHO",
>> "DIESINUEVE", "VEINTE",
>> "VEINTIUN",
>> "VEINTIDOS", "VEINTITRES", "VEINTICUATRO",
>> "VEINTICINCO",
>> "VEINTISEIS",
>> "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE")
>> laDecenas = Array("DIEZ", "VEINTE", "TREINTA",
>> "CUARENTA",
>> "CINCUENTA",
>> "SESENTA", "SETENTA", "OCHENTA", "NOVENTA")
>> laCentenas = Array("CIENTO", "DOSCIENTOS", "TRESCIENTOS",
>> "CUATROCIENTOS",
>> "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS",
>> "OCHOCIENTOS",
>> "NOVECIENTOS")
> Nice array, if you need it, you can use it directly in PHP, just add a
> $ sign before the variable and ; at the end, and it is a PHP array :)
> <snip>
>
> I've snipped the rest of your code, because it's very though to
> understand the code if you can't read the language. Like i said, show
> me what you want to convert from and to, so that i can help you
> writing something new, or comment your own macro in english so that
> people can understand it.
I deleted the original, but...
90% of the macro can be converted to PHP by putting $ in front of all
the variables.
90% of the function names are the same, or very similar.
There was one "MOD" call that needs to change to %
Do all that, run it in PHP, fix any syntax errors, and then run tests
side-by-side and compare outputs.
I'm betting it's a no-brainer conversion, based on what I recall of
the OP.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?