RE: [PHP] Newbie User Def Function Question

From: Date: Fri, 16 Feb 2001 15:18:27 +0000
Subject: RE: [PHP] Newbie User Def Function Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40148@lists.php.net to get a copy of this message
I found the possible problem and a solution. I was putting the function below the function call. This is how it worked with Perl and I was trying to do it the same way. I couldn't figure out how to put this function earlier in the script so I put the code I wanted to re-use in a separate script and called it with include. This worked very well. I'm tackling a sheet music database for my wife which might be a little over my head as a newbie but I'm learning a lot from it. Jeff Oien > I'm not getting any errors but the function display isn't > doing anything. Thanks. > Jeff Oien > > > <?php > > > > function someFunction($var) > > { > > echo $var; > > } > > > > // Your script > > > > someFunction("Foobar!"); > > ?> > > > > if you're creating an instance of a class object.... > > > > <?php > > class someClass > > { > > function someFunction($var) > > { > > echo $var; > > } > > > > } > > > > $someClass = new someClass; > > > > $someClass->someFunction("Foobar!"); > > > > ?> > > > > Cheers, > > -Jonathan Sharp > > > > > -----Original Message----- > > > From: Jeff Oien [mailto:jeff@webdesigns1.com] > > > Sent: Thursday, February 15, 2001 8:01 PM > > > To: PHP > > > Subject: [PHP] Newbie User Def Function Question > > > > > > > > > Could anyone give me the correct syntax for calling a function. > > > > > > I have a block of code I want to reuse. How do I name this > > > code block and how do I call it? Having a hard time finding an > > > answer looking through docs. It's so basic I can't find > > > an explanation. :) > > > Jeff Oien > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#40148) next »