Avatar of rgb192
rgb192
Flag for United States of America asked on

do you personally use reflection class? Is this something I need to learn?

I am learning about reflection class because
reflection class is in 4th edition of matt zandstra 'objects patterns practice'

I also read (not understood) 3rd edition years ago

I have not read first, second


my question:
Do you use reflection class?
After reading expert comment who says 'rarely', I think maybe I am reading about reflection class because it could have been in a first edition of a book and updated for a fourth edition
PHP

Avatar of undefined
Last Comment
rgb192

8/22/2022 - Mon
SOLUTION
Julian Hansen

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Ray Paseur

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
rgb192

ASKER
Slick812 I asked this question because of one of your comments

You wrote alot of
'DO NOT'

but what should I learn as a beginner to oop?

And Julian
what are
First get the basics of PHP and OO right
rgb192

ASKER
Thanks.

I realized that my original question was answered.
I think Ray's answer of a code sample about Reflection was good but following advice of all three experts; I ran once and did not spend hours learning.


My followup question is:
https://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28425653.html
Member_2_248744

AHH, rgb192, a good question! You have asked several questions here in EE about PHP Object tutorials, and as you say this question is about the "4th edition" , and you say - "I also read (not understood) 3rd edition years ago"
You seem to think that Object Oriented programming code is a very different thing than the normal PHP code without objects. The way you use Objects in code with a ->  is different that the other older way, and putting code inside of a Class is also different, but for me the WORK that has to be done for a web page output, is the SAME code work, like to connect to database -
try {$dbo = new PDO("mysql:host=host;dbname=db1", "name", "password");

you have to use that same line of code whether you use OO or normal PHP code, and you also MUST use the code -
$stmt = $dbo->prepare('INSERT INTO guest1 (name, date, email) . . . .

whether you use OO or normal PHP code, , to place the data needed for your site to work,  into the DB table.
You have seemed to miss the understanding that  the Class code writing is suppose to be a GOOD way to get neccessary work done (database access, sort arrays, do product displays in HTML table rows, re-size Images) for one or many PHP pages in a functional web site. You need to know about -
1. Basic Class - properties, declare a method, what $this is a reference to, the __construct( ) , using the "new" to produce an object. , what static can be used for.

2. Try and SEE HOW doing a Class can HELP you do better code, because you REDUCE the amount of code and WORK a developer does, saves them TIME and HEADACHES.

here is some code that I actually used-
<?php include 'p4pLook.php';
$p4obj = new p4pLook('hilight',216,'kowork');?><!doctype html>
<html lang="en"><head><title>JQuery Ajax for PHP</title><link rel="stylesheet" type="text/css" href="p4p.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<script src="p4p.js"></script>
<?php $p4obj->doHead('Products on Sale',3); ?>
<div id="mid"><center>
<?php $p4obj->doBlu('intro531.txt',true); 
$p4obj->doBar();$p4obj->doOrngCor('Specials!', 'ox1', 'specials1.txt');
$p4obj->doBar();$p4obj->doProduct('ID-sale448', 'ox2',580);
$p4obj->setCode('fort5');
 ?>
</center></div>
<?php $p4obj->doFoot('obsto42.txt'); ?>
<script>/* <![CDATA[ */
menu1=getDom("m1");
var mHgt=menu1.offsetHeight-12;
var aNum = menu1.getElementsByTagName("a");
for(var i=0;i< aNum.length;i++) {aNum[i].onclick=nomenu;}
aNum[aNum.length-1].style.margin="0";
/* ]]> */</script>
</body></html>

Open in new window

I have used my p4pLook.php, which has a CLASS in it, then I get an object with -
$p4obj = new p4pLook(

and produce some complex and lengthy page code writes with methods-
$p4obj->doBlu( )
using CONDITIONALS  'hilight',216,'kowork'   from the object creation
new p4pLook('hilight',216,'kowork');

by using this
$p4obj = new p4pLook( )
in several different pages, I do NOT have to re-write 40 to 120 lines of PHP code and just have one line -
$p4obj->doOrngCor('Specials!', 'ox1', 'specials1.txt');

this saves me TIME and effort! BUT IF, I did NOT use a CLASS and object, I would still have to write the same PHP work code (mysql access, image retrieval and check, price check, inventory check) that I do in a Class, and the Class code Helps me do less work!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
rgb192

ASKER
Hi Slick812,
I opened a new question to ask a question about your comment.

https://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28425755.html