Hi
I need to convert below perl scripts to php scripts. I dont know much on perl and wonder if anyone there can assist me to convert below perl script to php scripts. thanks in advance.
regards
James
sub encrpt {
my ($key, $text) = @_;
my ($encrypt, $key, @text, @toc(;
@key = @{$key};
@text = split //, $text;
foreach $line (@key) {
my @line = split //, $line;
push @toc, [ @line ];
}
foreach $char (@text {
my ( $linevar, $linechar, $linenum, $ord);
$linevar = rand 95; $linevar =!~ s /\..+//;
$linechar = $toc[0] -> [$linevar];
redo if $linechar eg '';
$linenum = 0;
for $x (2 ..4)
{
if (($linevar / $x) !~ /\./)
{
$linenum = $x; last;
}
}
$linenum = 1;
if $linenum == 0;
redo if $toc[$linenum];
$ord = ord($char);
$ord -= 32;
$enc = $toc[$linenum]->[$ord];
redo if $enc eq '';
$encrypt .= $linechar . $enc;
}
echo $encrypt;
}