PHP Classes

File: example.php

Recommend this page to a friend!
  Packages of Muhammad Umer Farooq   PHP String class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP String class
Convert and replace text strings
Author: By
Last change: Apply fixes from StyleCI
Date: 8 years ago
Size: 901 bytes
 

 

Contents

Class file image Download
<?php

require_once 'classes/String.php';
$str = new Strings();

$string = 'I love CPP';

$hack = "<script>alert('working');</script>";

$replace = $str->ReplaceWords(
[
    'replacing_word' => 'CPP',
    'replacing_with' => 'php',
    'text'           => $string,
]);
$lower_case = $str->StringConversion(
[
    'type' => 'lowercase',
    'text' => $replace,
]);
$upper_case = $str->StringConversion(
[
    'type' => 'uppercase',
    'text' => $replace,
]);
$camel_case = $str->StringConversion(
[
    'type' => 'camelcase',
    'text' => $replace,
]);

$clean_secured = $str->CleanInput(
[
    'type'  => 'secured',
    'input' => $hack,
]);
$clean_root = $str->CleanInput(
[
    'type'  => 'root',
    'input' => $hack,
]);

echo $replace;
echo '<br>';
echo $lower_case;
echo '<br>';
echo $upper_case;
echo '<br>';
echo $camel_case;
echo '<br>';
echo $clean_secured;
echo '<br>';
echo $clean_root;