Object Oriented Programming in php - Crude in php

I am going to show you that how to build a website by using the crud in php. I will show you four basic functions of Crud(Insert, Select, Update, Delete). This is actually object oriented technique to perform.

Let's start.... :)

First of all you should have knowledge about that how to use classes and objects in php.

Here is an example that how to write class in php.
PHP Code:
  1. <?php 
  2. // use the class keyword to define a class name
  3. class MyClassName{
  4. // you may also can initialize or declare data members and member functions here that can be public private or protected 

  5. private $MyVariable=" This is test value";
  6.  
  7. // member function of this class

  8.  public showResult(){

  9. echo $this->MyVariable;
  10.  
  11. }
  12.  
  13. }// Ending the class 
  14.  
  15. // creating an object of this class 
  16.   
  17.  $Object = new MyClassName();
  18.  
  19.  // Accessing the member function of class
  20.  
  21.  $Object->showResult();
  22.  
  23. ?>
Result
This is test value

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I guess today there is no person who would not use even a small degree a computer and web applications. We may not even know that we are just using such solutions, and thanks to them we are able to do a lot. Of course, it is not enough just to click in these programs, but I think that using them is also not very complicated.

    ReplyDelete