Kalo bagian nyang ini aku pake buat nge-handle operasi String, mulai dari Enkripsi ampe Decrypt-nya,,
belum sempurna banget, tapi lumayan lah buat kreasi sendiri mah… iya ga???
<?php
class string_Operation{
protected $word;
public function string_Operation($newKata){
$this->word=$newKata;
return $this->word;
}
function Decrypt()
{
$i=0;$U=”";$T=”";$K=”";$L=”";
for($i=0;$i<strlen($this->word);$i++)
{
$T = substr($this->word,$i,1);
$U = ord($T);
$U += 30;
$K = chr($U);
$L =$L.$K;
}
return $L;
}
function Encrypt()
{
$i=0;$U=”";$T=”";$K=”";$S=”";
for($i=0;$i<strlen($this->word);$i++)
{
$T = substr($this->word,$i,1);
$U = ord($T);
$U-=30;
$K=chr($U);
$S=$S.$K;
}
//echo $S;
return $S;
}
}
?>