2017 © Pedro Peláez
 

library php-string

PHP String wrapper class and methods

image

hota1024/php-string

PHP String wrapper class and methods

  • Wednesday, January 31, 2018
  • by hota1024
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PHPString

PHP String wrapper class and methods., (*1)

Installation

Use composer

Type this command., (*2)

composer require hota1024/php-string, (*3)

Can't you use composer?

OK., (*4)

  1. Download this repository.
  2. Extract the PHPString-master.zip.
  3. You can use PHPString-master/src/hota1024/String.php

How to use it?

composer

require_once "path/to/vendor/autoload.php";

$str = new hota1024\Str('Hello world!');
echo $str; # Hello world!

Don't use composer

include "path/to/String.php";

$str = new hota1024\Str('Hello world!');
echo $str; # Hello world!

Tutorial

Step1「Create String object」

$string = new hota1024\Str('string value'); # Create string object.

Troublesome coding hota1024\Str?, (*5)

You can use this code., (*6)

use \hota1024\Str;, (*7)

use \hota1024\Str;

$string = new hota1024\Str('string value');

Step2「Output string value」

Usually use echo., (*8)

$helloworld = new Str('Hello world!');
echo $helloworld; # Hello world!

If you wish objective programming code?, (*9)

You can use this method., (*10)

$helloworld = new Str('Hello world!');
$helloworld->output(); # Hello world!

Step3「String to Array」

$helloworld = new Str('Hello world!');
var_dump($helloworld->asArray()); # Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => w [7] => o [8] => r [9] => l [10] => d [11] => ! )

Step4「Reverse string」

You can make reverse string., (*11)

$apple = new Str('Apple');
$apple->reverse();
echo $apple; # elppA

You wish reversed value?, (*12)

$apple = new Str('Apple');
$rev = $apple->reversed();
echo $rev; # elppA

Step4.1「Write compact code」

$apple = new Str('Apple');
$apple->reverse();
echo $apple; # elppA

↓, (*13)

$apple = new Str('Apple');
$apple->reverse()->output(); # elppA

The Versions

31/01 2018

dev-master

9999999-dev

PHP String wrapper class and methods

  Sources   Download

MIT

The Development Requires

by Avatar hota1024