PHP Classes

File: index.php

Recommend this page to a friend!
  Packages of Elyess Zouaghi   String Class   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: demo
Class: String Class
Manipulate text strings
Author: By
Last change: removed list of supported methods, for full list see string.class.php file
Date: 16 years ago
Size: 618 bytes
 

 

Contents

Class file image Download
<?php
    require ("string.class.php");
    
    $s = new String("Hello World !");
    
    echo $s;
    
    echo "<br>";
    
    echo $s->toUpper();
    
    echo "<br>";
    
    echo $s->toLower();
    
    echo "<br>";
    
    echo $s->substr(0, 5)->length();
    
    echo "<br>";
    
    $h = new String("hello");
    
    if ($s->substr(0, 5)->toLower() == $h) {
        echo "it's hello";
    }
    
    echo "<br>";
    
    if ($h->not("world")) {
        echo "it's not world!";
    }
    
    echo "<br>";
    
    $x = $s->concat(" yes ", $h);
    
    echo $x;
    
    echo "<br>";
    
    echo ($x->toLower()->eq("hello world ! yes hello") ? "it's full lower!" : "not full lower");
?>