twsJames
twsJames

Reputation: 425

PHP to Coldfusion

I need to convert the following line of PHP into Coldfusion

$age = 10
$test = pow($age,-2)*log($age);

Coldfusion does not have a POW() function. This is what I have come up with

<cfset age = 10>
<cfset test = age^-2*log(age)>

Any help would be much appreciated.

James

Upvotes: 2

Views: 572

Answers (2)

Jeromy French
Jeromy French

Reputation: 12121

You're likely to notice performance and maintainability gains if you place this (and any sets immediately preceding or following) code within cfscript. Oh, and don't forget to scope your variables:

<cfscript>
   variables.age = 10;
   variables.test = variables.age^-2*log(variables.age);
</cfscript>

Upvotes: -1

pho
pho

Reputation: 25479

The ^ operator does the job

You are doing it right

Upvotes: 3

Related Questions