Make your own free website on Tripod.com
Home     My Faqts     Contributors     About     Help    

FAQTS : Computers : Programming : Languages : PHP : Language and Syntax : Functions

Entry Add Entry Alert - Edit this Entry

Did You Find This Entry Useful?

3 of 10 people (30%) answered Yes
Recently 2 of 9 people (22%) answered Yes

How do I set a global variable variable in a function?

Jun 8th, 1999 09:00

Nathan Wallace
Frank M. Kromann


You have to globalize both variables.
  
<?php

$test = "test1";

function tt() {
 global $test;
 global $$test;

 print("$$test\n");
}

$test1 = "jhkjh";

tt();

?>



1999-2000 Synop Software