OS X - Development and Darwin Discussion and questions about development for Mac OS X.

php questions


Post Reply New Thread Subscribe

 
Thread Tools
fearlessfreap24

 
fearlessfreap24's Avatar
 
Member Since: Feb 09, 2005
Location: Near San Diego, CA
Posts: 2,339
fearlessfreap24 is just really nicefearlessfreap24 is just really nicefearlessfreap24 is just really nicefearlessfreap24 is just really nice
Mac Specs: MacBook Pro 13" | MacBook Pro 13" | Mac Mini 2GHz C2D

fearlessfreap24 is offline
i have gotten some books on PHP and i am in the process of going through the activities. i ran in to this problem. while trying to access a variable outside of a function, the screen doesn't print what is supposed to. here is the script

<?php
$life = 42
function meaningoflife () {
global $life;
echo "the meaning of life is $life";
}
meaningoflife();
?>

is there any reason why this should not print "the meaning of life is 42"???

thanks in advance

QUOTE Thanks
fearlessfreap24

 
fearlessfreap24's Avatar
 
Member Since: Feb 09, 2005
Location: Near San Diego, CA
Posts: 2,339
fearlessfreap24 is just really nicefearlessfreap24 is just really nicefearlessfreap24 is just really nicefearlessfreap24 is just really nice
Mac Specs: MacBook Pro 13" | MacBook Pro 13" | Mac Mini 2GHz C2D

fearlessfreap24 is offline
i found the problem. i was doing all of the task on one page. the task before it was almost the exact same thing:
<?php
$life = 42;
function meaningoflife () {
echo "the meanin of life is $life";
}
meaningoflife ();
?>

QUOTE Thanks
Murlyn

 
Murlyn's Avatar
 
Member Since: Jun 11, 2003
Location: Mount Vernon, WA
Posts: 4,905
Murlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to all
Mac Specs: MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2

Murlyn is offline
Good to hear that you figured it out If you have any other questions, feel free to post them
QUOTE Thanks

Post Reply New Thread Subscribe


« REALbasic 4.5 worth $25? | Terminal and Applescript »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
my local host and php are not playing nice? este Web Design and Hosting 2 07-26-2005 06:08 PM
Setting up PHP and PHP Nuke EvoMac Web Design and Hosting 2 02-18-2005 12:38 PM
Php vtupser Web Design and Hosting 5 02-16-2005 03:36 AM
Fears and Questions - Upgrading from OS9 to OSX Panther RamonMedina OS X - Operating System 2 01-03-2004 08:05 PM
Bogus PHP bug on Mac OS X... mark Web Design and Hosting 19 10-03-2003 07:34 PM

All times are GMT -4. The time now is 07:00 PM.

Powered by vBulletin
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?