473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2702
"Cpt. Zeep" <ze**@nemame.com> wrote in message
news:bt**********@bagan.srce.hr...
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($person); ?>

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?

"CountScubula" <me@scantek.hotmail.com> wrote in message
news:p3****************@newssvr29.news.prodigy.com ...
"Cpt. Zeep" <ze**@nemame.com> wrote in message
news:bt**********@bagan.srce.hr...
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.23058$JD6.795@lakeread04...
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 "CountScubula" <me@scantek.hotmail.com> napisal w wiadomosci
news:p3****************@newssvr29.news.prodigy.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
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...
5
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...
21
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...
0
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...
16
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...
2
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
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...
3
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
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...
23
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.