Skip to content
a javascript like php string api
PHP
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
String
tests
README.md
phpunit.xml

README.md

String

a javascript like php string api

why ?

  • string functions in php are a mess and hard to remember
  • every developpers know javascript
  • So the easiest way to work with strings in php is to work with a javascript string api like.

author M.PARAISO , Paris France

contact mparaiso@online.fr

Usage

require("String/String.php");
use String\String;
$string = new String("value");
echo $string; // echo the word value

Call string functions as instance methods or static methods

$string = new String("my string");
echo $string->indexOf("st"); // echo 3;
echo String::indexOf("my string","st"); // echo 3;

API

Implemented methods :

  • concat
  • indexOf
  • replace
  • search
  • slice
  • split
  • substr
  • substring
  • toLowerCase
  • toUpperCase
  • trim
Method Signature Returns

static

TODO

  • write doc
  • implement the following api :
Something went wrong with that request. Please try again.