Solved

PHP fucntions with parameters

Posted on 2009-07-07
3
198 Views
Last Modified: 2012-05-07
Hi:

I got some problems with PHP functions

I'd like to declare a PHP function, using Zend Studio 6

function testfunc ()

{

}


function testfunc ($aVar)
{

}

The first function, testfunc(), without parameter is OK
The 2nd function, testfunc($aVar), has syntax error.

I could not figure out why because it seems trivial to have such parameter.

Maybe I made some error.

If you've some idea, please help.

Thanks

Somits
0
Comment
Question by:somits
3 Comments
 
LVL 3

Accepted Solution

by:
cmorbach earned 500 total points
ID: 24795381
Call it testfunc2, you can't overload functions in PHP.


function testfunc ()
 

{
 

}
 
 

function testfunc2($aVar)

{
 

}

Open in new window

0
 

Author Comment

by:somits
ID: 24795438
Hi cmorbach:

Thanks for the reply.

Actually, I didn't overload the function.

I only have 1 function in the php file: testfunc.

However, if this function does not have any parameter. it's OK.
If I added a parameter into it, it has syntax error.

Somits
0
 
LVL 11

Expert Comment

by:BrianMM
ID: 24795490
Is it Zend Studio thats reporting it? or have you tried calling in in a browser?

I have not used Zend Studio for a while ( I prefere Eclipse ).
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now