473,915 Members | 5,000 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 2725
"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
2726
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 I'm trying to do here. It's too many lines of code to debug right now. I'm searching for...
5
3048
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
2548
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
1164
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 root attribute with the serializer.
16
2913
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 (Collection) of Purchase objects. Now, these Purchase objects were pulled from a datasource Datasource. The...
2
1691
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
3721
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 class objects and sets 0s to POD types. This is what I've learned from the books (especially...
3
1847
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
3049
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
3164
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 the limitations and
0
9881
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11066
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7256
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5943
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3368
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.