Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Supressing Warnings

Posted on 2003-03-06
6
Medium Priority
?
222 Views
Last Modified: 2008-02-07
Hi All!

If I define a function like so:
// Start of Code
function printviewform($var) {
// End of Code

Is there any way I can supress the warnings given if the argument $var isn't passed to it?

Any help is appreciated,

Enune
0
Comment
Question by:enune
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
VGR earned 200 total points
ID: 8084262
yes, of course. Make it (Ada-Like) an optional parameter by providing a default value

declare the function as :
function printviewform($var="") {

and that's all
0
 

Author Comment

by:enune
ID: 8086073
Thanks VGR. :)
0
 
LVL 15

Expert Comment

by:VGR
ID: 8086526
no problem.
Where does the (first?) name "Enune" come from ?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:enune
ID: 8097573
My highly imaginative and fragmented mind. :P

Thanks again,

Enune (Or 'Noony' to friends)
0
 

Author Comment

by:enune
ID: 8097584
PS. With your example above, would that not restrict any value being passed to $var, as it sets it to "" when the function is called?

Or am I being clueless again?

Enune
0
 
LVL 15

Expert Comment

by:VGR
ID: 8101294
no
it's the default value, that's the one if no value is provided as an argument
if $var received a value by argument, fine. If no argument makes it through, $var will have it's default value as per the si gnature of the function.
This is 100% ADA
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

564 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