What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP help

PHP help
Author: Message:
lordy
Senior Member
****


Posts: 853
Reputation: 24
34 / Male / Flag
Joined: Jul 2004
Status: Away
O.P. PHP help
Just got a quick question... if I'm creating a function in PHP, and I'm creating variables in said function. How do i make those variables available outside the actual function? I know how to make variables created outside the function available inside the function... but how do you do the reverse?

for example:

code:
$blah = 2;
$blah2 = 4;

function yay() {
global $blah, $blah2;

$minus = $blah2 - $blah;
$plus = $blah + $blah2;
}


I know that doesn't do anything but meh its an example...

if what I understand is correct, to make those variables ($plus and $minus) available to other things outside the function, do i also need to add them to the global statement alongisde $blah and $blah2 inside the actual function??

This post was edited on 12-25-2007 at 01:37 PM by lordy.
12-25-2007 01:15 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP help - by lordy on 12-25-2007 at 01:15 PM
RE: PHP Variables - by Eljay on 12-25-2007 at 01:37 PM
RE: PHP help - by lordy on 12-25-2007 at 01:38 PM
RE: PHP help - by Eljay on 12-25-2007 at 01:42 PM
RE: PHP help - by lordy on 12-25-2007 at 01:44 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On