Advertisement
Guest User

Res

a guest
Feb 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.     public final class Res()
  3.     {
  4.         const ARRAY = 1;
  5.         const OBJECT = 0;
  6.  
  7.         private $dataType = null;
  8.        
  9.         public function setDataTypeIsArray()
  10.         {
  11.             $this->$dataType = self::ARRAY;
  12.         }
  13.  
  14.         public function setDataTypeIsObject()
  15.         {
  16.             $this->$dataType = self::OBJECT;
  17.         }
  18.  
  19.         public function setData()
  20.         {
  21.             if($this->$dataType === self::ARRAY)
  22.             {
  23.                 // do something
  24.             }
  25.             else if($this->$dataType === self::OBJECT)
  26.             {
  27.                 // do something
  28.             }
  29.         }
  30.     }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement