halm1985 Posted September 24, 2007 Share Posted September 24, 2007 How can i make variables set in a function available for use in other functions within the page .. Link to comment https://forums.phpfreaks.com/topic/70502-passing-variables-within-functions/ Share on other sites More sharing options...
pocobueno1388 Posted September 24, 2007 Share Posted September 24, 2007 Use the return keyword. Here is an example of how you could get a variable for use outside a function. <?php function createVar($value){ $var = $value; return $var; } Now you could do this: $var = createVar($value); and then you have the variable $var to use outside of the function. Link to comment https://forums.phpfreaks.com/topic/70502-passing-variables-within-functions/#findComment-354155 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.