PHP Classes

Hawk PHP Extended Object: Manipulating basic data types as objects

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 40 All time: 10,919 This week: 560Up
Version License PHP version Categories
hawkphp_extendobj 1.0Freeware7Data types, PHP 7
Description 

Author

This package allows manipulating basic data types as objects.

It provides several classes that can perform different types of operations with values of basic data types.

Currently, it provides classes to manipulate integers, strings, floats, and arrays.

Picture of tianfan
Name: tianfan <contact>
Classes: 3 packages by
Country: China China

Example

<?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());


  Files folder image Files (5)  
File Role Description
Files folder imagehawkphp (4 files)
Accessible without login Plain text file example.php Example package

  Files folder image Files (5)  /  hawkphp  
File Role Description
  Accessible without login Plain text file arrayObj.php Class class for ARRAY type
  Accessible without login Plain text file floatObj.php Class class for FLOAT type
  Accessible without login Plain text file intObj.php Class class for INT type
  Accessible without login Plain text file stringObj.php Class class for STRING type

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:40
This week:0
All time:10,919
This week:560Up