Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

PHP Variable Scopes – Static Variables – Full PHP 8 Tutorial

52.3K views on YouTube

In this PHP tutorial, you will learn what variable scope is, global & local scopes, & more. You will also learn how you can use static variables to optimize your code & cache the value of expensive function calls.

SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
👍 Smash the like button
🤝 Subscribe to the channel & turn the notifications on
💬 Post comments, any feedback is greatly appreciated
⭐ Become a Patreon: https://www.patreon.com/programwithgio
THANK YOU!

LESSON 1.23
Course Outline – https://github.com/ggelashvili/learnphptherightway-outline
Course Playlist – https://www.youtube.com/playlist?list=PLr3d3QYzkw2xabQRUpcZ_IBk9W50M9pe-

CHAPTERS
00:00 – Variable scope
00:25 – Global scope
01:00 – Local scope
01:41 – Using global keyword to access variables in the global scope
02:12 – How are global variables stored & GLOBALS superglobal
03:13 – Static variables