PHP fucntions with parameters

Posted on 2009-07-07
Medium Priority
Last Modified: 2012-05-07

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.


Question by:somits

Accepted Solution

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

function testfunc ()
function testfunc2($aVar)

Open in new window


Author Comment

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.

LVL 11

Expert Comment

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 ).

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

597 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