1
0
wisetext/index.php
Christer Warén c42f9e4109 Init
2022-06-17 12:51:00 +03:00

60 lines
1.2 KiB
PHP

<?php
$characters = file_get_contents(__DIR__."/characters.json");
$characters = json_decode($characters);
echo "
=============== WiseText Generator ===============
";
echo "\n\n";
$stdin = fopen('php://stdin', 'r');
echo "Select Mode: "."\n";
echo "1: Normal Text to Wise Text "."\n";
echo "2: Wise Text to Normal Text "."\n";
$input = trim(fgets($stdin));
echo "\n"."\n";
if(isset($input) && $input != '' && $input == '1'){
echo "Insert text: "."\n";
$input = trim(fgets($stdin));
if(isset($input) && $input != ''){
$input = mb_strtoupper($input);
foreach($characters as $key => $value){
$input = str_replace($key, $value, $input);
}
echo "\n"."\n";
echo "Answer: "."\n";
echo "$input"."\n"."\n";
}
}
if(isset($input) && $input != '' && $input == '2'){
echo "Insert text: "."\n";
$input = trim(fgets($stdin));
if(isset($input) && $input != ''){
$input = mb_strtoupper($input);
foreach($characters as $key => $value){
$input = str_replace($value, $key, $input);
}
echo "\n"."\n";
echo "Answer: "."\n";
echo "$input"."\n"."\n";
}
}
?>