0

ive been coding the plain old procedural way in php and i want to move that code to object oriented.
can i just simply use my currently written php code into a function and then call it?


pleas let me know an easy way to make my normal php code into object oriented?

5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by jenyroger
-2

Your plan sounds about right.

Votes + Comments
The OP seems quite unaware of what he/she it trying to do, and the response is so incorrect it sounds sarcastic.
0

I would start over.
Try make a general library with things you need like a database class, its great practice and will help speed up future projects.

0

A class is a group of php code that you can use to create a massive set of data you write it the same way you do php code with a few exceptions.

class First(){

 $this->text = "My First class"

}

//and you call it like so,

$firstclass - new First();

//echo "My First Class";
echo $firstclass->text;

in the class you can add any number of php code and functions and put the data in $this->variable.

0

In PHP the concept of OOP is less code there is just a logic of this concepts . There arfe some data types of OOP are using in PHP code there might be use of inheritance and abstract concepts are using for the PHP level for coding . For PHP the logic must be clear other wise you cant do the coding .

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.