Solved

Using variable outside of if statement

Posted on 2006-11-03
1
231 Views
Last Modified: 2006-11-18
Hi Experts,

I have just come back to PHP programming after a stint of doing vb.net. I am wondering if there is a way to continue a variable outside of an IF statement.

Would this require Register Globals switched on?

0
Comment
Question by:nickmarshall
1 Comment
 
LVL 49

Accepted Solution

by:
Roonaan earned 125 total points
ID: 17865008
No,

You can just use the variable outside the if statement. Scopes are defined by the global scope, classes and functions. If's and loop's do not define a scope of themselves in PHP.

-r-
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now