 |

03-29-2005, 09:06 AM
|
|
WebProWorld Member
|
|
Join Date: Mar 2005
Posts: 29
|
|
instantiate an object dynamically
Hello firends
How to instantiate an object dynamically?(When we dont know name of class until our code is executed)
Please give me an example.
|

03-29-2005, 09:22 AM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: UK
Posts: 2,803
|
|
So many questions
Can't answer your question, but I don't really see any relevance to Web Programming either. What exactly are you trying to do here? I have a suspicion these are questions being asked as part of a programming course.
Maybe we need to introduce a separate forum purely for all of these "hard-core" PHP questions!
|

03-29-2005, 09:32 AM
|
|
WebProWorld Member
|
|
Join Date: Mar 2005
Posts: 29
|
|
Please guide,Thanks
Dear sir
See,Honestly,I'm learning PHP by these:
PHP 5 my sql bible
PHP 5 for dummies
I laso read Php manually form php.net
I wanna learn object oriented chapters.But I can't
Then Please guide me about these,
Thank you very much indeed
|

03-29-2005, 08:01 PM
|
|
WebProWorld Veteran
|
|
Join Date: Aug 2003
Location: Cornwall, UK
Posts: 862
|
|
Code:
<?php
class test {
function a() {
echo "Hello World\n";
}
}
$clsName = 'test';
$obj = new $clsName();
$obj->a();
?>
That works in PHP4, I haven't tried it in PHP5 but it will probably work.
Personally I quite like the books "PHP Cookbook" and "Programming PHP" from O'Reilly.
Quote:
|
Can't answer your question, but I don't really see any relevance to Web Programming either.
|
Paul, I can think of a few uses for this on large complex web projects.
|

03-29-2005, 09:47 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
|
|
I'm with Paul. Something doesn't seem right with these questions. They're both too generic and too theoretical to apply to specific instances.
abalfazi: I'm guessing that the questions that you have may be symptoms of a deeper problem. Forgive me for saying this, but it is fairly obvious that English isn't your mother tongue. My suggestion, if you wish to learn these languages from textbooks, is to do one of two things:
1) Purchase textbooks in your native language.
2) Acquire a better grasp of the English language.
Again, this is intended as a constructive criticism, not a derogatory one, and I ask that you interpret it as such.
|

03-30-2005, 06:24 AM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: UK
Posts: 2,803
|
|
Quote:
|
Originally Posted by speed
Paul, I can think of a few uses for this on large complex web projects.
|
I'm sure on some level this question may well have a relevance.
My point is more of a general one, aimed at the growing list of unanswered questions.
If you look at the context in which abalfazl's questions are asked. There's no background information supplied, they do not directly relate to any specific problem. They look like academic questions you might find at the end of a chapter in a textbook or in a college worksheet.
Paul
|

03-31-2005, 12:30 AM
|
|
WebProWorld Member
|
|
Join Date: Mar 2005
Posts: 29
|
|
Sorry
First of all, thanks for your answer dear Speed. I
agree with you that "PHP CookBook" is an interesting
book, especially chapter 7 .
And others, instead of praising each other, you
better go and take a look at the chapter!
I'm sorry that am registered in a forum of this kind
with such suggestions and knowledge of this level.
Thanks for reading.
Bye.
|

04-04-2005, 05:24 PM
|
|
WebProWorld Pro
|
|
Join Date: Feb 2004
Location: England Baby!
Posts: 222
|
|
Quote:
|
Can't answer your question, but I don't really see any relevance to Web Programming either.
|
Are you suggesting that there's no need for object orientated programming for the web? These questions didnt seem like coursework to me. Just a case of someone who wants to learn something new.
|

04-04-2005, 05:41 PM
|
|
WebProWorld Pro
|
|
Join Date: Feb 2004
Location: England Baby!
Posts: 222
|
|
Sorry paulhiles,
I didnt notice the other 10 or so posts abalfazl had added. Yup, it definately looks like last minute revision in a topic he obviously has very little knowladge about. All the questions are very abstract to say the least.
|

04-04-2005, 05:58 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: UK
Posts: 2,803
|
|
No problem Chris!
For what it's worth, I'm all in favour of object oriented programming for web applications! ;o)
Paul
|

04-04-2005, 08:31 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
|
|
Thou shalt not question thy programming Mod-God. Paul is wise in the ways of those who wish to gain knowledge for the purposes of completing a conceptual obligation.
Be thee well and truly warned, my people. If thou art guilty of the sin of gaining knowledge from WPW for the purposes of completing thy educational assignments, Paul will smiteth down upon thine ass with British dry wit used to mask annoyance.
(Okay, that's as British as I get.)
|

04-05-2005, 05:36 AM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: UK
Posts: 2,803
|
|
LOL!! Spoken like a native!
ADAMWebDesign, You've been watching way too much Monty Python but point taken! :o)
Paul
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|