Looking through the notes I noticed a few people expressing
concern that PHP5 does not support multiple constructors...
Here is an example of a method that I use which seems to
work fine:
class Example
{
function __construct()
{
echo "do some basic stuff here";
}
function Example($arg)
{
echo $arg;
}
}
You then can call with or without arguments without having
notices and/or warnings thrown at you... Of course this is
limited but if you don't need something complex this can
help to get the job done in some situations. I believe you
could also add arguments to the __construct() function and
as long as it is different than Example() 's args you would
be fine. Although I have yet to test this.
----
Server IP: 64.71.164.2
Probable Submitter: 72.12.219.139
----
Manual Page --
http://www.php.net/manual/en/language.oop5.decon.php
Edit -- https://master
.php.net/note/edit/78430
Del: integrated -- h
ttps://master.php.net/note/delete/78430/integrated
Del: useless -- http
s://master.php.net/note/delete/78430/useless
Del: bad code -- htt
ps://master.php.net/note/delete/78430/bad+code
Del: spam -- https:/
/master.php.net/note/delete/78430/spam
Del: non-english --
https://master.php.net/note/delete/78430/non-english
Del: in docs -- http
s://master.php.net/note/delete/78430/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78430
Reject -- https://mast
er.php.net/note/reject/78430
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|