Aeonfree com is good for web hosting

Latest topics from the forums

I always recommend writing something like this without HTML.

Write functions, or objects, but not loops with HTML

you can already generate.

Something like that (untested)

  1. $ alphabet = [];
  2. // Note: start with $ i = 1 for 1-26 array offsets.
  3. for ($ i = 1, $ char = 'a'; $ i <= 26; $ i ++) {
  4. $ alphabet [$ i] = $ char;
  5. // Note: PHP gets the next char in alphabet on ++.
  6. $ char ++;
  7. }

And you just pack this little thing away in a function (e.g.:).

Next you want to encode and decode.

So there will surely be a soUndSoEncode and soUndSoDecode function.

These two will then surely (can) use common code.

So you pack this code, even if only small loops etc., into a function,

which both can then use.

Often I first write down how I actually want to call up the whole thing,

without knowing what to expect.

Roughly (as an object (OOP)):

  1. // clear text example input
  2. $ text = 'foo bar baz';
  3. // encode
  4. $ caesar = new Caesar ();
  5. $ encryptedText = $ caesar-> encrypt ($ text);
  6. // decode
  7. $ clearText = $ caesar-> decrypt ($ encryptedText);

So know I already what I would like to have for (public) functions.

You or someone who would use it later don't care what happens in there.

The main thing is that the call is "pleasant".

If you want to display that as a website, then the installation is quite easy.

But it is nicely separated - function (Caesar) and controller (input | output (HTML, ....)).

I recommend always writing something like that without HTML.
Write functions, or objects, but no loops with HTML  :)