Nathan Rixham wrote:
> Daniel Kolbo wrote:
>> Hello,
>>
>> Is there a way to see what objects and functions a script
>> loaded/required/used?
>>
>> I could recursively loop through the globals, but if objects were unset,
>> then i may miss some.
>>
>> I could make a 'tracking' object and every time
Daniel Kolbo wrote:
Hello,
Is there a way to see what objects and functions a script
loaded/required/used?
I could recursively loop through the globals, but if objects were unset,
then i may miss some.
I could make a 'tracking' object and every time i load/include a file
(which contains a clas
Hey Stu.
Well, isn't that special ;--)
Jesus, I kept echoing $this->$foo within the parent class and getting 0,
instead of 1.
You wrote your reply; I checked the results again, and, voila, it worked --
obviously I must have been missing something and corrected the mistake in my
endless trial
Sounds like a PHP version problem. PHP 4 will output 0 and PHP 5 will give
1. The constructor must be named the same as the class name in PHP 4 for
this to work.
You can have both constructors in your class so it will work in both
versions.
- Frank
> I don't know the details of your app, but you
PHP wrote:
Problem:
Class test {
var $foo = 0;
function __construct() {
$this->myfunc("foo", 1);
}
function myfunc($name, $val) {
$this->$name = $val;
}
}
Now, PHP correctly evaluates $this->$name as 0; i.e. the default property
value of $this->foo.
How
I don't know the details of your app, but you might want to reconsider a
resdesign.
Having said that, your code actually works for me. If I use your class as is,
foo is 1. That is:
$x = new test;
echo $x->foo;
outputs 1. Isn't that what you want?
Regards,
Bruce
>>> "PHP" <[EMAIL PROT
Hey all.
Problem:
Class test {
var $foo = 0;
function __construct() {
$this->myfunc("foo", 1);
}
function myfunc($name, $val) {
$this->$name = $val;
}
}
Now, PHP correctly evaluates $this->$name as 0; i.e. the default property
value of $this->foo.
However
Cheseldine, D. L. wrote:
Hi
I'm stuck on The Basics page of the php5 Object Model:
http://uk.php.net/manual/en/language.oop5.basic.php
The top example has the code:
A::foo();
even though foo is not declared static in its class. How does it get
called statically without being declared static
I'd say it depends on the size of your project and on any plans to reuse
the code. Classes are better suited for building libraries of code you
use in other projects. And any large project runs into problems with
function names if the programmer doesn't use a rigorous naming system
(like "function
I have a function to load the classes and return the object.
function LoadClass($ClassName)
{
require_once("Class.$ClassName.inc");
return new $ClassName();
}
Its working fine.
But Zend Studio's Code completion is not working for this type of
object, Any hints?
Zareef,
In Zend Studio 4.0 (not sure
On Mon, 14 Mar 2005 10:28:06 -0800, Jamie Alessio
<[EMAIL PROTECTED]> wrote:
> > I have a function to load the classes and return the object.
> >
> > function LoadClass($ClassName)
> > {
> > require_once("Class.$ClassName.inc");
> > return new $ClassName();
> > }
> >
> > Its working fine.
> >
> > B
Jochem Maas wrote:
Dmitry wrote:
Thanks,
but I think that this code more easy.
class a {
function say() { echo "A"; }
function run() { $this->say(); }
}
class b {
function say() { echo "B"; }
function run() {
$a = new a;
$a->run();
for starters b doesn't even extend a
and secondly the
Dmitry wrote:
Thanks,
but I think that this code more easy.
class a {
function say() { echo "A"; }
function run() { $this->say(); }
}
class b {
function say() { echo "B"; }
function run() {
$a = new a;
$a->run();
for starters b doesn't even extend a
and secondly the b::run() method is c
Thanks,
but I think that this code more easy.
class a {
function say() { echo "A"; }
function run() { $this->say(); }
}
class b {
function say() { echo "B"; }
function run() {
$a = new a;
$a->run();
}
}
$obj = new b;
$obj->run();
--
PHP General Mailing List (http://www.php.net/)
Jonel Rienton wrote:
hi again guys, is there a tool that can allow you view the available
interfaces of a class, like an object/class browser that can help you view
the signatures of those interfaces?
thanks and regards,
Jonel
You should be able to use the Reflection API to find out what you want
Oliver Hitz wrote:
> Thank you. I know there is a `===' operator, but to me this doesn't
> make sense either.
>
> class A { }
> class B { var $x; }
>
> It is logical that an instance of `A' is not identical to null.
> However, why is an instance of `A' equal (`==' operator) to null, an
> instan
On 29 Jul 2004, Mehdi Achour wrote:
> Hi Oliver, you should test with === instead of ==
> http://php.net/manual/en/language.operators.comparison.php
Thank you. I know there is a `===' operator, but to me this doesn't make
sense either.
class A { }
class B { var $x; }
It is logical that an
Hi Oliver, you should test with === instead of ==
http://php.net/manual/en/language.operators.comparison.php
didou
Oliver Hitz wrote:
Hi all,
I have stumbled across something odd related to classes, instances and
NULL in PHP 4. Apparently, an instance of a class that doesn't contain
any variables
do you get an error-message? which?
maybe you use
var $id = array();
instead of
var $id[];
ciao SVEN
Patrik Fomin wrote:
> I need to create a class that looks like this:
>
> class Artikel {
> var $id[];
> var $rubrik[];
> var $ingress[];
> var $kategori[];
> var $frontbildtyp[];
> var $fron
On Sun, 2003-07-20 at 02:28, Andu wrote:
>
> One shouldn't apply industrial theories to just everything.
>
Object Oriented Design is not an industrial theory. It's a tried and
true practice with over a decade of computer science and practical use
behind it. Procedural programming is a subset of
--On Sunday, July 20, 2003 07:53:20 +0200 Simon Fredriksson
<[EMAIL PROTECTED]> wrote:
I've been working like that for about two years and just recently I got
enlighted in the use of classes.
The main reason I started this thread is that since I'm just beginning with
php I thought I might as w
* Thus wrote Simon Fredriksson ([EMAIL PROTECTED]):
> [...]
> just got confused. Then, suddenly I got some class for something,
> checked out the code and my brain just snapped. "aaah, THAT's how it's
> done!". It wasn't well documented, just nicely structured and easy to
> read and understand.
I've been working like that for about two years and just recently I got
enlighted in the use of classes. I've built a few sites and after a
while on each of them I run into a problem. Say I wanna add a
meta-refresh tag or send a cookie; with my earlier code, that brought
out hell... more or les
I'm quite new to OOP myself, but these two articles
helped my understanding a lot
See the sidebar - Classes and Object Oriented
Programming
http://webreference.com/perl/xhoo/php1/5.html
Taking PHP the OO way
http://phpmag.net/itr/online_artikel/psecom,id,284,nodeid,114.html
olinux
--- Sam Bau
Hi there,
am Saturday 19 July 2003 16:30 schrieb Curt Zirzow:
> Sam Baum <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> am Friday 18 July 2003 23:08 schrieb Andu:
>>
>> > This may show my ignorance or my refusal to take for granted something
>> > I don't fully understand but I have a hard time figuri
Sam Baum <[EMAIL PROTECTED]> wrote:
> Hi,
>
> am Friday 18 July 2003 23:08 schrieb Andu:
>
> > This may show my ignorance or my refusal to take for granted something I
> > don't fully understand but I have a hard time figuring out the advantage
> > of using classes as opposed to just functions. I
t; <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 19, 2003 11:59 AM
Subject: [PHP] Re: classes v. functions
> Hi,
>
> am Friday 18 July 2003 23:08 schrieb Andu:
>
> > This may show my ignorance or my refusal to take for granted something I
> >
I am sure someone will call this heresy, but if you really want OO don't
(Bdo it in PHP. If you are new to OO and start with PHP you will do
(Byourself a grat disfavour. OO programming in PHP is still not ready. If
(Byou try and program in OO in PHP you have to learn all of it's
(Bshortcomings
Hi,
am Friday 18 July 2003 23:08 schrieb Andu:
> This may show my ignorance or my refusal to take for granted something I
> don't fully understand but I have a hard time figuring out the advantage
> of using classes as opposed to just functions. I am certainly new to php
> and at first sight clas
yes (as has been said); the code in the included file adopts 'the scope in
the place at the point of the include statement'. Hence if you were to put
the the include statement in a function the vars in the included file would
have the scope of that function; included outside a function they'll have
"Sunfire" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> just a fast question here.. and the lotic probably isnt to bright on my
part
> and i think i know the answer to this question too but just to make
sure...
> if you can include variables in an include file and use them outside t
>Could someone please explain the difference between classes and functions
>and how to use a class. I write alot of PHP, but I never understood this at
>all. I use an include statement in many of my pages and include a file with
>a bunch of functions. For instance, I might have a function called s
PHP does not support multiple constructors. But, It does support
variable argument lists, so you can fake it with func_get_args() and
func_get_num_args():
function issue() {
if( func_get_num_args() > 0 ) {
$args = func_get_args()
} else {
// do something else...
yes you can put as many classes as you want inside a file doesn't matter.
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Gerard Samuel)
wrote:
> Maybe a simple question.
> But can one file contain 2 or more classes??
> Thanks
>
--
PHP General Mailing List (http://www.php.net/)
To unsubs
try $this->http://www.zend.com/zend/tut/class-intro.php
shann.
"Phil Schwarzmann" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can anyone direct me to a nice site that will take my hand and walk me
> through the basics of classes and $this->
>
> Ive
Cameron Just wrote:
> Hi,
>
> Is this a bad thing to do have a class stored within another class?
>
> I would also like to store an array of another class within a class.
>
> It seems to work apart from the fact that I can't reference an array of
> class directly.
> ie
> $test_array[0]->get(
> I'm writing a class for POP3 access and I want some of the internal
> functions to be private, like the mime decoding stuff.
>
> Is there any way to do this? I found nothing in the docs :(
Unfortunately, PHP does not understand terms private, public, protected...
PHP coders adopted a coding sta
when you reference a property of a class you don't need to say it's a
variable,
so use $this->item[] instead of $this->$items[$id] and it works okay. I
haven't quite worked out why it went wrong in the way it did ... and that'll
worry me until I do.
Tim Ward
Senior Systems Engine
38 matches
Mail list logo