Mr_J Posted September 16, 2008 Share Posted September 16, 2008 Fatal error: Call to undefined function: display_value() in /usr/www/users/medbqq/jaco/sams2/load18.php on line 8 code: 1 <?php 2 $value = 100; 3 function change_value($value) { 4 global $value; 5 echo "before: $value "; 6 $value = $value * 2; 7 } 8 display_value () ; 9 echo "After: $value <br>"; 10 ?> Link to comment https://forums.phpfreaks.com/topic/124450-solved-function-display/ Share on other sites More sharing options...
paul2463 Posted September 16, 2008 Share Posted September 16, 2008 means that function display_value () { some code } does not exist Link to comment https://forums.phpfreaks.com/topic/124450-solved-function-display/#findComment-642669 Share on other sites More sharing options...
Mchl Posted September 16, 2008 Share Posted September 16, 2008 Perhaps you want: <?php $value = 100; function change_value($value) { global $value; echo "before: $value "; $value = $value * 2; } change_value () ; echo "After: $value"; ?> Although this code doesn't make much sense. Link to comment https://forums.phpfreaks.com/topic/124450-solved-function-display/#findComment-642684 Share on other sites More sharing options...
Mr_J Posted September 16, 2008 Author Share Posted September 16, 2008 Perhaps you want: <?php $value = 100; function change_value($value) { global $value; echo "before: $value "; $value = $value * 2; } change_value () ; echo "After: $value"; ?> Although this code doesn't make much sense. Almost... This is what I did and it works!! Thanx allot <?php $value = 100; function change_value() { global $value; echo "Before: $value "; $value = $value * 2; } change_value() ; echo "After: $value <br>"; ?> Link to comment https://forums.phpfreaks.com/topic/124450-solved-function-display/#findComment-642694 Share on other sites More sharing options...
Mchl Posted September 16, 2008 Share Posted September 16, 2008 Try something like this: function change_value() { global $value; $value = $value * 2; } $value = 100; echo "before: $value "; change_value () ; echo "After: $value"; ?> It's basically same code, but makes more sense this way Link to comment https://forums.phpfreaks.com/topic/124450-solved-function-display/#findComment-642696 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.