PHP STATIC VARIABLE EXAMPLE

  • PHP only supports static variables within the scope of a function definition
  • Static variables are, in fact, variable. The “static” means that the variable retains its value between calls to whatever that variable’s scope is (function, class, procedure, etc.)
  • Variables in PHP can only be static within the context of a function. Once a script exits, all variables are released. If you need to share variables between scripts, then you’ll need to either use sessions (I would think this would usually be the best solution), send them via form POST or GET data, or use a database for data persistence.

here is an example paste of static variable in PHP

you can see the output here

 

Advertisements

Magento 2 Install Problem

1.The requested PHP extension ext-intl * is missing from your system.
Problem 1

– The requested PHP extension ext-intl * is missing from your system.

Solution : Go to php.ini and enable uncomment the2015-10-05_195736

 

2. If you are stuck with the token and getting error something like,

Could not fetch https://api.github.com/repos/{module} , please create a Github QAuth token to go over the API rate limit. Head to https://github.com/settings/tokens/new?=scope……..To retrieve token. It will be stored in “C:/user/appdata/user/roaming/composer/auth.js” for future use by composer.

Solution:

Go to the link in browser which is written after “Head to” , login with your password in github. Click on generate token. Get token > copy it > paste it SSH where it is asking for the token (hidden).

Process will be resumed.

 

3. I have successfully installed Magento2 but CSS and JS are missing. Getting this error “NetworkError 404 Not Found – path of Css or JS.

Solution 1:

You get 404 responses probably because you don’t have mod_rewrite enabled.

Solution 2:

It might be because of pub/static folder. There is a ‘cache’ system for these static resources. Every time Magento requests a resource from pub/static, if the file does not exist the request is rewritten to ../static.php?resource={resource name here}.

Run this command,

The command will copy all the static resources from each module to the pub/static folder.