Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Creating the Menu and Footer Using Variables for the Title Tag

variables scope and sublime text?

hi i have 2 questions please 1-i want to ask about sublime text , is it allowed to me for use it free? because in the website(am not sure if i get what they mean) you need to give 70$ for license or something like that?

2-as i know from c++ and some programming language , that if the variable outside the functions and classes and you defined it before main then you can access it , but in this example i saw define variable in page , and call it in another page ?! is any vars outside functions are global so you can call from any place in the same page also anyplace in other pages? thank you

1 Answer

Q1: sublime text is free to use it has a popup if you chose this option though. Q2: on the second on if i am reading this right yes you can globally call a var in a function. this is as lone as you are still working with the current data set. like i set $var1 = "example"; on page A anything thing i do with all the data from page A i can access it. but if i got to page B when page B is initially processed and sent to the use $var1 has not yet been set on page B so i can not do anything with it unless i set it again. but if you have stored $var1 in the session if can be accessed on any subsequent page until it is unset or replaced.

thanks