Using an actual variable in function params?

This is a discussion on "Using an actual variable in function params?" within the PHP Forum section. This forum, and the thread "Using an actual variable in function params? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 11th, 2008, 17:50
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Using an actual variable in function params?

Hi,

In a function, when you have parameters, you would usually just do:
functionname(param, example)

But I want to make it so the user, when referencing the function, enters a variable name. For example, when my function is called, it should look like:
function($variable).

How do I do this? If I created the function would it be:
PHP: Select all

function test($variable) {
echo 
$variable;

In that case would it actually display the variable name (INC the $)

Cheers!

Jack
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote

  #2 (permalink)  
Old Mar 11th, 2008, 18:06
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: Using an actual variable in function params?

Fixed it In the example above, when calling the function, do:
test($variable) and it should work.
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
Reply

Thread Tools

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dump actual header alexgeek PHP Forum 6 Jan 23rd, 2008 14:54
Can I force IE to open img at actual size? billysalisbury PHP Forum 11 Oct 26th, 2007 16:16
is this variable right? geyids PHP Forum 4 Aug 6th, 2007 21:45
Displaying the actual URL on page shockbeton Web Page Design 9 Jun 22nd, 2006 18:35
using params in xsl IF element zzqproject Other Programming Languages 0 Nov 21st, 2005 23:12


All times are GMT. The time now is 06:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43