PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
  Classes of Zhao  >  Bijection URL shortening  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: demo for short url
Class: Bijection URL shortening
Encode and decode values for short URLs
Author: By
Last change:
Date: 3 years ago
Size: 349 bytes
 

 

Contents

Class file image Download
<?php

use rbib\util\string\encode\Bijection;

include
'rbib/util/string/encode/Bijection.php';

$bijection = (new Bijection());
//create short url based on int(100)
$encode_id = $bijection->encode(100);
echo
$encode_id; //aNbC

//decode the short url to int (100)
$decode_id = $bijection->decode($encode_id);
echo
$decode_id; //100