[PHP] Re: Classes and Functions

2009-12-28 Thread Daniel Kolbo
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

[PHP] Re: Classes and Functions

2009-11-04 Thread Nathan Rixham
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

Re: [PHP] Re: Classes in PHP5 || Puzzling Problem || Trying to Set $this->$name = $value

2007-03-09 Thread PHP
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

Re: [PHP] Re: Classes in PHP5 || Puzzling Problem || Trying to Set $this->$name = $value

2007-03-08 Thread Frank M. Kromann
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

Re: [PHP] Re: Classes in PHP5 || Puzzling Problem || Trying to Set $this->$name = $value

2007-03-08 Thread Stut
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

[PHP] Re: Classes in PHP5 || Puzzling Problem || Trying to Set $this->$name = $value

2007-03-08 Thread Bruce Cowin
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

[PHP] Re: Classes in PHP5 || Puzzling Problem || Trying to Set $this->$name = $value

2007-03-08 Thread PHP
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

[PHP] Re: classes and objects: php5. The Basics

2007-01-16 Thread Daniel Kullik
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

[PHP] Re: Classes or functions

2005-10-22 Thread Oliver Grätz
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

[PHP] Re: Classes code completion and Zend Studio

2005-03-14 Thread Jamie Alessio
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

[PHP] Re: Classes code completion and Zend Studio

2005-03-14 Thread Zareef Ahmed
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

Re: [PHP] Re: Classes and parents.

2005-01-22 Thread M. Sokolewicz
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

Re: [PHP] Re: Classes and parents.

2005-01-22 Thread Jochem Maas
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

[PHP] Re: Classes and parents.

2005-01-22 Thread Dmitry
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/)

[PHP] Re: Classes and Interface tool

2004-10-27 Thread Jason Barnett
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

RE: [PHP] Re: Classes, instances and NULL

2004-07-29 Thread Michael Sims
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

Re: [PHP] Re: Classes, instances and NULL

2004-07-29 Thread Oliver Hitz
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

[PHP] Re: Classes, instances and NULL

2004-07-29 Thread Mehdi Achour
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

[PHP] Re: Classes

2003-07-25 Thread sven
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

Re: [PHP] Re: classes v. functions

2003-07-20 Thread Robert Cummings
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

Re: [PHP] Re: classes v. functions

2003-07-19 Thread Andu
--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

Re: [PHP] Re: classes v. functions

2003-07-19 Thread Curt Zirzow
* 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.

Re: [PHP] Re: classes v. functions

2003-07-19 Thread Simon Fredriksson
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

Re: [PHP] Re: classes v. functions

2003-07-19 Thread olinux
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

Re: [PHP] Re: classes v. functions

2003-07-19 Thread Sam Baum
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

Re: [PHP] Re: classes v. functions

2003-07-19 Thread 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 figuring out the advantage > > of using classes as opposed to just functions. I

Re: [PHP] Re: classes v. functions

2003-07-19 Thread Ryan A
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 > >

[PHP] Re: classes v. functions

2003-07-19 Thread Jean-Christian IMbeault
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

[PHP] Re: classes v. functions

2003-07-19 Thread Sam Baum
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

[PHP] Re: classes and functions in include files

2003-02-27 Thread David Eisenhart
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

[PHP] Re: classes and functions in include files

2003-02-27 Thread rush
"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

[PHP] Re: Classes vs. Functions

2002-07-18 Thread Richard Lynch
>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] Re: Classes Constructor syntax

2002-07-17 Thread Matthew Gray
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...

[PHP] Re: Classes??

2002-04-21 Thread Smileyq
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

[PHP] Re: classes & $this->

2002-02-01 Thread shann
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

[PHP] Re: Classes within classes (Should I do this?)

2001-12-05 Thread Yasuo Ohgaki
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(

[PHP] Re: Classes and functions

2001-11-28 Thread Roko Roic
> 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

[PHP] RE: Classes and arrays

2001-05-09 Thread Tim Ward
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