Asked  2 Years ago    Answers:  5   Viewed   49 times

is there a way to create my own custom superglobal variables like $_POST and $_GET?

 Answers

1

Static class variables can be referenced globally, e.g.:

class myGlobals {

   static $myVariable;

}

function a() {

  print myGlobals::$myVariable;

}
Saturday, August 13, 2022
1

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario: http://confluence.jetbrains.com/display/PhpStorm/PHPUnit+Installation+via+Composer+in+PhpStorm

Related usability ticket: http://youtrack.jetbrains.com/issue/WI-18388

P.S. The WI-18388 ticket is already fixed in v8.0

Sunday, July 31, 2022
 
4

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Sunday, November 6, 2022
3

Have you looked at get_cfg_var( config_var )?

http://www.php.net/manual/en/function.get-cfg-var.php

I believe this is for retrieving custom variables from e.g. the servers php.ini file

Thursday, November 3, 2022
 
1

You have some options here :

Create them global (not best practice ) :

for(var i = 0; i < list.lenght; i++){ 
  window['counter' + i] = 0;   // create counter1, counter2,...)
}

Use object :

var scope = {};
for(var i = 0; i < list.lenght; i++){ 
  scope['counter' + i] = 0;   // create scope.counter1, scope.counter2,...)
}

Use Object with with keyword

var scope = {};
for(var i = 0; i < list.lenght; i++){ 
  scope['counter' + i] = 0;   // create scope.counter1, scope.counter2,...)
}
with(scope){
 // here you can acesess keys in the scope object like them variable on the function scope
 counter0++
}

Use plain old Array

var scope = new Array(list.length);
Tuesday, November 1, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 

Browse Other Code Languages