Reputation: 11120
I am looking to port some application code from PHP to ColdFusion
ColdFusion Variables:
variables.*
request.*
session.*
application.*
server.*
form.*
url.*
arguments.*
PHP variables
$something
$_POST['something']
$_GET['something']
function getSomething($something){
global $someglobal;
$something
...
Upvotes: 1
Views: 590
Reputation: 46
Here are the available scopes in ColdFusion with their appropriate PHP counterpart to the right:
If you use a variable name without a scope prefix, ColdFusion checks the scopes in the following order to find the variable:
Local (function-local, UDFs and CFCs only) => No array.
Arguments => ?
Thread local (inside threads only) Query (not a true scope; variables in query loops) => ?
Thread => ?
Variables => $GLOBALS[]
CGI => $_SERVER[]
Cffile => $_FILES[]
URL => $_GET[]
Form => $_POST[]
Cookie => $_COOKIE[]
Client => ?
Request => $_REQUEST[]
Here are the pages where I would use to reference:
http://php.net/manual/en/language.variables.superglobals.php
Upvotes: 2
Reputation: 57267
I don't do ColdFusion, but I can hazard some guesses based on this documentation.
For starters, PHP doesn't classify its variables explicitly by scope.
variables.*
...is just $var1
or $foo
or whatever. It's scoped depending on its location - is it in a function, a class, free, etc.
request.*
These are apparently "non-persistent global variables" which are probably $_GET[]
and $_POST[]
(both arrays) in PHP.
session.*
That's an easy one. $_SESSION
.
application.*
This is probably best approximated by $_SERVER.
On that page are several other variable types that will probably answer your question. Be wary, though, in PHP global variables are a quick invitation to security holes.
Upvotes: 1