Supressing Warnings

Posted on 2003-03-06
Medium Priority
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,

Question by:enune
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
  • 3
LVL 15

Accepted Solution

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

Author Comment

ID: 8086073
Thanks VGR. :)
LVL 15

Expert Comment

ID: 8086526
no problem.
Where does the (first?) name "Enune" come from ?
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.


Author Comment

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

Thanks again,

Enune (Or 'Noony' to friends)

Author Comment

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?

LVL 15

Expert Comment

ID: 8101294
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

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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

764 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