Teste - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Teste.php
- <?php
- function bestSignEncode(string $name, $email=null, $tel=null){
- $array = [$name, $email, $tel];
- $json = json_encode($array);
- $base64 = base64_encode($json);
- $special = strtr($base64,['+'=>'-','/'=>',','=='=>';','='=>':']);
- $array = str_split($special);
- $even = '';
- $odd = '';
- foreach ($array as $k => $v){
- if ($k === 0 || $k % 2 == 0) $even .= $v;
- else $odd .= $v;
- }
- return $odd.'_'.$even;
- }
- function bestSignDecode(string $str){
- $oe = explode('_', $str);
- $odd = $oe[0];
- $even = $oe[1];
- $length = max(strlen($odd),strlen($even));
- $special = '';
- for ($i=0; $i<$length; $i++){
- $special .= $even[$i] . $odd[$i];
- }
- $base64 = strtr($special,['-'=>'+',','=>'/',':'=>'=',';'=>'==']);
- return base64_decode($base64);
- }
- echo $encoded;
- echo "\n";
- $decoded = bestSignDecode($encoded);
- echo $decoded;
File Description
- Teste
- PHP Code
- 05 Feb-2021
- 885 Bytes
You can Share it:
Latest PHP Pastes