?
Solved

PHP fucntions with parameters

Posted on 2009-07-07
3
Medium Priority
?
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
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

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

649 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