PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Pashkov Denis Igorevich   Iso Var   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: example
Class: Iso Var
Manage variables with multiple values
Author: By
Last change:
Date: 11 years ago
Size: 3,093 bytes
 

Contents

Class file image Download
<?php
include 'Iso.php';
use
IsoMorph\Iso;
$iso = Iso::getIso();
echo
"<h3> ISO </h3> ";
 

// Example class needed for testing..
class Boo{
    public function
hello($v1="",$v2=""){
        echo
$v1 . " BOOOOO!!!! ".$v2;
    }
   
    public function
test(){
       
        echo
"TEST2 ";
    }
}

class
Foo{

    public function
stack($v){
        echo
$v;
    }
   
   
    public function
test(){
        echo
"TEST";
    }
}
$iso->server = "127.0.0.1";
$iso->boo = new Boo();
 


echo
$iso->server;
 

echo
"<br>";
// set Context for variable which represent Scope.
Iso::getIso()->setContext("Hmc");
$iso->server = "Holly";
echo
$iso->server;
echo
"<br>";

// set Context back to default .
$iso->setContext("default");
$iso->server = "test";
echo
$iso->server;


echo
"<br>";

// Call Method from one of the variable.
// If method exists in curent variable then call it, else iterate thru all variable in curent context and try to find method or it's overloads.
$iso->hello();
echo
"<br>";


$iso->int = "Hello ";
$iso->int = 23;

echo
$iso->int + 2;
echo
"<br> ";
echo
$iso . " World";
echo
"<BR> <hr> ";

// Iterate thru all vlues of 'server' variable
$iso->server;
while(
$val = $iso->iterate())
    echo
"<p> ".$val." </p>";


echo
"<br> <hr> ";


// reload hello
$iso->boo ;
$iso->reload("hello", function($this=null){ print_r($this); echo " waka waka ";});
$iso->hello("server" );
$iso->int = "aas";

echo
"<br> <hr>";
echo
$iso->int;
// Set Alias For Curent Variable ....
$iso->setLinking("year");
$iso->setLinking("y2013");
echo
$iso->year;
echo
$iso->year;
echo
$iso->y2013;
$iso->int = array(1,2,3,4,5);

echo
"<br> " ;
$iso->foo = new Foo();


// Call all Methods
$iso->MassCall("test",array(1));
echo
"<br> ";


// Get Value By Specified Type
$iso->int;

   
print_r($iso->getInType(Iso::$TYPE_ARRAY));
   
print_r($iso->getInType(Iso::$TYPE_STRING));
   
print_r($iso->getInType(Iso::$TYPE_INT));


echo
"<br> ";

// Check Has int vriable a Array
print_r($iso->isArray());

echo
"<br>";
$iso->int =2 ;


// Check reverse

echo $iso->int ;
$iso->reverse() ;
echo
$iso->int;
$iso->reverse() ;
$iso->int = "pashkovdenis@gmail.com";
echo
$iso->int;
echo
"<br><hr>";



// Get minimum And Max Values (int arraycount or str length) Of Variable .
echo $iso->getMax();
echo
"<br><hr>";
print_r($iso->getMin());


echo
"<br><hr>";
// Summarize Checking
echo $iso->Sum();
echo
"<br>";
echo
$iso->Sum(array(1,2,3,4,5,65,6));
echo
"<br>";


$iso->integer = 1;
$iso->integer = 2;
$iso->integer = 3;
$iso->integer = 4;
$iso->integer = 5;
echo
$iso->Sum();
 
$iso-> int ;
/// Testing Match For PREG MAtch
echo "<br> ";
print_r($iso->Match(Iso::$PREG_MAIL));
print_r($iso->Match(Iso::$PREG_NUMBER));


echo
"<hr>";
// Closure test

$iso->run = function ($str = "runnig"){
echo
$str;
} ;

$iso->int = 12;

$iso->run();

$iso->int =13 ;
echo
$iso->int ;