S
S
sizzeR2018-09-14 21:28:22
PHP
sizzeR, 2018-09-14 21:28:22

How to make a simple cipher?

For example, A = 1, B = 2, C = 3;
If you write in the AB text field, then 12 is displayed, and if CB, then 32, etc.?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Loginov, 2018-09-14
@0id202

Use str_replace:

$a = ['A', 'B', 'C'];
$b = ['1', '2', '3'];
echo str_replace($a, $b, 'CB');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question