PHP Classes

File: RotatorTest.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Mo´se  >  PHP String Rotate  >  RotatorTest.php  >  Download  
File: RotatorTest.php
Role: Example script
Content type: text/plain
Description: example script
Class: PHP String Rotate
Rotate strings in different ways
Author: By
Last change: correct typo
Date: 3 years ago
Size: 2,435 bytes
 

Contents

Class file image Download
<?php

require('str_rotator.class.php');
 
 echo
'<pre>';
$dictionary=implode('',range('a','z '));//str_rot13 basic

$newrotator=new str_rotator($dictionary);

var_dump($newrotator->rotate('dictionary contains duplicated characters')===str_rot13('dictionary contains duplicated characters'));
           
           
$dictionary=str_shuffle(implode('',range('a','z ')));//str_rot13 custom variant

$newrotator=new str_rotator($dictionary);

var_dump($newrotator->rotate('dictionary contains duplicated characters')===str_rot13('dictionary contains duplicated characters'));
 
 
$dictionary=implode('',array_merge(range('a','z'),range(0,9)));//str_rot18 basic
$newrotator=new str_rotator($dictionary);

var_dump($newrotator->rotate($newrotator->rotate('dictionary contains duplicated characters')));



$dictionary=str_shuffle(implode('',array_merge(range('a','z'),range(0,9))));//str_rot18 custom variant

$newrotator=new str_rotator($dictionary);

var_dump(
$newrotator->rotate('dictionary contains duplicated characters'),$newrotator->getRotationFactor(),
$newrotator::InvertTwoCharsPos($newrotator::c_rot('dictionary contains duplicated characters',rand(0,25))),
$newrotator::InvertTwoCharsPos($newrotator::InvertTwoCharsPos('dictionary contains duplicated characters')),
$newrotator::autoRotate('dictionary contains duplicated characters'),
$newrotator::c_Rot('dictionary contains duplicated characters',25)
);

 
$content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.";
 
var_dump($encode=$newrotator::autorotate($content),$newrotator::invertCharsSlot($content,7),$newrotator::autorotate($encode));



For more information send a message to info at phpclasses dot org.