forked from klaussilveira/SimpleString
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.php
More file actions
executable file
·26 lines (22 loc) · 794 Bytes
/
demo.php
File metadata and controls
executable file
·26 lines (22 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require('SimpleString.class.php');
$string = new SimpleString('lorem ipsum dolor sit amet lorem ipsum');
$string->shorten(10);
$string->toSentenceCase();
echo $string;
$string = new SimpleString('Lorem ipsum dolor sit amet lorem ipsum');
$string->shorten(15)->toCamelCase();
echo $string;
/**
* SimpleString also uses overloading to create an object-oriented
* interface for built-in string functions. Functions starting with
* str or str_ can just be used with their actual name, not prefix.
*
* So: strtolower = tolower, str_replace = replace.
*
* Functions whose return values are not string are invalid and will
* throw exceptions.
*/
$string = new SimpleString('Lorem ipsum dolor sit amet lorem ipsum');
$string->tolower()->replace('lorem', 'mortem');
echo $string;