Solved

PHP fucntions with parameters

Posted on 2009-07-07
3
202 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
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.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

732 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