PHP Forums Archive

translate CFM into PHP

Tags: php, loop, coldfusion

pitos posted on 2008-03-04 20:27:15 #

Hi, I have a problem with my site due to ColdFusion cfmail tag, so I decided translate the whole code to PHP, but I am new with this languaje and I do not know the sintaxis, so if someone knows how can I translate it, I will appreciate. Thanks.

The follow code is for a virtual store:

<CFLOOP collection="#Session.Carrito#" item="i">
<cfset xnumero = #Session.Carrito[i][10]#>
<cfif not isnumeric(#xnumero#)>
<cfset xnumero = 1>
</cfif>
</CFLOOP>

Comments / discussions

Olaf posted on 2008-03-04 20:50:15 #

I don't know so much about CF (actually nothing)

but I think it's some test inside a loop like:

if (!is_numeric($var)) $var = 1;

maybe you can describe the function a little bit more

pitos posted on 2008-03-04 22:03:00 #

I had read something about LOOPS in PHP, and I finded the function FOREACH, I think this function is similar to CFLOOP, but I'll continue searching. Thanks for your response.

Olaf posted on 2008-03-05 06:19:43 #

yeah, I like the foreach very much, most of all if you have an associative array