473,563 Members | 2,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object without class

Hello all!

I have a question regarding next few lines of code.

<?php
$person->name = "John Doe";
$person->age = "26";
?>

What does this piece of code actually do? It seems to create object $person,
but i am not shure if i can create objects without defining class first? I'm
little confused here :) This reminds me of structures in C...
Thanx!

--
Relaxen und watch das blinkenlights.. .
Jul 17 '05 #1
6 2715
"Cpt. Zeep" <ze**@nemame.co m> wrote in message
news:bt******** **@bagan.srce.h r...
Hello all!

I have a question regarding next few lines of code.

<?php
$person->name = "John Doe";
$person->age = "26";
?>

What does this piece of code actually do? It seems to create object $person, but i am not shure if i can create objects without defining class first? I'm little confused here :) This reminds me of structures in C...
Thanx!

--
Relaxen und watch das blinkenlights.. .


nothing more than an empty object with variables in it, 2 in this case

php is realy nice about auto.... (I forget the word) Basicaly, when you
first use something, it will be created for you right then. This is one
major differnce from a script language and a compiled one. dont get me
wrong, you can do this in a high level language, however for really tight
code compiling. say for a microchip, you do not want the overhead of
auto-defining. you simple state how big a varaible is going to be, so it
makes room for it.


--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #2
Cpt. Zeep wrote:
<?php
$person->name = "John Doe";
$person->age = "26";
?>

What does this piece of code actually do? It seems to create object $person,
but i am not shure if i can create objects without defining class first?


try <?php echo get_class($pers on); ?>

It will output "stdClass" which is the pseudo-class PHP uses for
uninitialized objects.

Jochen

Jul 17 '05 #3
TG
CountScubula if you are the one who runs the gzentools.com site, your e-mail
address of in**@gzentools. com is bouncing, I am getting a message that says
relaying denied. I sent you an email that bounces with this error message,
how can I contact that site?

"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:p3******** ********@newssv r29.news.prodig y.com...
"Cpt. Zeep" <ze**@nemame.co m> wrote in message
news:bt******** **@bagan.srce.h r...
Hello all!

I have a question regarding next few lines of code.

<?php
$person->name = "John Doe";
$person->age = "26";
?>

What does this piece of code actually do? It seems to create object

$person,
but i am not shure if i can create objects without defining class first?

I'm
little confused here :) This reminds me of structures in C...
Thanx!

--
Relaxen und watch das blinkenlights.. .


nothing more than an empty object with variables in it, 2 in this case

php is realy nice about auto.... (I forget the word) Basicaly, when you
first use something, it will be created for you right then. This is one
major differnce from a script language and a compiled one. dont get me
wrong, you can do this in a high level language, however for really tight
code compiling. say for a microchip, you do not want the overhead of
auto-defining. you simple state how big a varaible is going to be, so it
makes room for it.


--
Mike Bradley
http://gzen.myhq.info -- free online php tools

Jul 17 '05 #4
"TG" <tg********@cox .net> wrote in message
news:xBXJb.2305 8$JD6.795@laker ead04...
CountScubula if you are the one who runs the gzentools.com site, your e-mail address of in**@gzentools. com is bouncing, I am getting a message that says relaying denied. I sent you an email that bounces with this error message,
how can I contact that site?


I need to stop configuring stuff when I am sleep deprieved, I needed to
restart sendmail, it did not notice the new entry in local-host-names.

thanks for the info, it is working now.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #5
Thanx everybody!

--
Relaxen und watch das blinkenlights.. .
Jul 17 '05 #6
The term you're looking for is "autovivication ." Ok, I had to look it up in
my camel book.

Uzytkownik "CountScubu la" <me@scantek.hot mail.com> napisal w wiadomosci
news:p3******** ********@newssv r29.news.prodig y.com...
php is realy nice about auto.... (I forget the word) Basicaly, when you
first use something, it will be created for you right then. This is one
major differnce from a script language and a compiled one. dont get me
wrong, you can do this in a high level language, however for really tight
code compiling. say for a microchip, you do not want the overhead of
auto-defining. you simple state how big a varaible is going to be, so it
makes room for it.


--
Mike Bradley
http://gzen.myhq.info -- free online php tools

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2715
by: Google Mike | last post by:
I need an Application object replacement. I was creating my own using shared memory -- shm* API in PHP. I was doing fine for 6 months until it just got too fat, I guess, and the RH9 Linux server just started "losing its memory". I don't know -- perhaps I'm doing something wrong, perhaps it's my code, or perhaps there's a limitation on what...
5
3035
by: ken | last post by:
IN the new gcc 3.3.1 I am getting messages like these: /data2/office/tools/bootstrp/sstring.cxx:105: error: cannot call member function `ULONG Container::Count() const' without object Where the Count is defined like this in the class: using Container::Count; So far I have worked around this by creating a member function. The
21
2492
by: Jason Heyes | last post by:
I want to allow objects of my class to be read from an input stream. I am having trouble with the implementation. Here are the different approaches I have tried: // Version 1.0 - Default constructors class MyClass { Foo foo; // foo and bar require default constructors Bar bar; public:
0
1151
by: rein.petersen | last post by:
Hi All, Some of you may have encountered complications when trying to serialize an object derived from CollectionBase (implementing ICollection or IEnumerable). Specifically, the XmlSerializer (as it is) won't allow you to treat an ICollection (or IEnumerable) object as the root node without using XmlAttributeOverides or sending in a new...
16
2882
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener will stay alive. Is this correct? If this is correct, I've got a problem. Let's say I've got an object Customer that has an PurchaseList...
2
1672
by: mpreisdorf | last post by:
I want to save the raw data of a class (without the .NET object overhead) to a binary file. For example: ref class Test { public: String^ name; Int32 number; ..... }
4
3697
by: Jess | last post by:
Hello, I tried several books to find out the details of object initialization. Unfortunately, I'm still confused by two specific concepts, namely default-initialization and value-initialization. I think default-init calls default constructor for class objects and sets garbage values to PODs. Value-init also calls default constructor for...
3
1831
by: Reckoner | last post by:
would it be possible to use one of an object's methods without initializing the object? In other words, if I have: class Test: def __init__(self): print 'init' def foo(self): print 'foo'
45
2978
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class clsData Private m_objSQLClient As clsSQLClient Private m_objUsers As clsUsers
23
3120
by: tonytech08 | last post by:
What I like about the C++ object model: that the data portion of the class IS the object (dereferencing an object gets you the data of a POD object). What I don't like about the C++ object model: that most OO features are not available for class object design without loss of POD-ness. So, I'm more than leaning toward "bad" because of...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.