1
0
wisetext/index.php

60 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2022-06-17 09:51:00 +00:00
<?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";
}
}
?>