Solved

PHP fucntions with parameters

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
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.

828 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