PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of tianfan   Hawk PHP Extended Object   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: package
Class: Hawk PHP Extended Object
Manipulating basic data types as objects
Author: By
Last change:
Date: 2 years ago
Size: 1,179 bytes
 

Contents

Class file image Download
<?php
/**
 *@package extendObj
 *@author Tianfan<arrbo@hotmail.com>
 *@license Apache License 2.0
 *@varsion 0.0.2
 *@description this file is an example
 */
namespace extendObj;
use
hawkphp;

function
loadLibrary($class){
   
$class=\substr($class,\strrpos($class,"\\")+1);
    require_once(
__DIR__.DIRECTORY_SEPARATOR."hawkphp".DIRECTORY_SEPARATOR.$class.".php");
    }
\
spl_autoload_register("extendObj\loadLibrary");

$a=new hawkphp\stringObj('abcdefg');
$b=$a->md5();
\
var_dump($b);
$c= $b->substr(3);
\
var_dump($c);

\
var_dump($c->isEmpty()?"true":"false");

$d=new hawkphp\intObj(40);
\
var_dump($d->chr());


$array=new hawkphp\arrayObj([5,7,9,6,8,10,80]);
$array->rsort()->each(
       function(
$key,$value){
        echo
$key."=>".$value." \n";
    });
$array->push(16)->each(
        function(
$key,$value){
    echo
$key."=>".$value."\n";
        }
    );

\
var_dump($array->toArray());
$f1=new hawkphp\floatObj(3.55);
$f2=new hawkphp\floatObj(2.9);
echo
$f1->toFloat()+$f2->toFloat();
echo
$f1->getInt($f1::CEIL);

$ak=new hawkphp\arrayObj(["a"=>["first"=>"a","last"=>"e","full"=>"apple"],"b"=>"banana","c"=>"coconut","d"=>"durian"]);
echo
$ak->a->full;

\
var_dump($ak->toArray());