Random character generator
A simple PHP script which generates descriptors for a character one may want to draw/sketch.
This was created as a recreation of a similar PHP script which was lost. I've written about that experience in more detail in a blog post on my blog.
It generates a random character on page load, but one may also reload the script (through AJAX) without needing to reload the page.
<?php
$adj = file('adj.txt');
$noun = file('noun.txt');
$myth = file('myth.txt');
$rnd = array_rand($adj, 2);
$rnd1 = array_rand($noun, 2);
$rnd2 = array_rand($myth, 2);
echo "<div>Your Daily Random Generated Character is: " . "</div>\n";
echo '<span class="large">' . trim($adj[$rnd[0]]) . " " . trim($adj[$rnd[1]]) . " " . "</span>" . '<span class="larger">' . $noun[$rnd1[0]] . " </span>\n";
echo "<div>who may or may not be " . "</div>\n";
echo '<div class="large">' . $myth[$rnd2[0]] . "</div>";
?>
Now while this is a super simple script, I wanted to at least take a moment to mention not being a stranger to PHP on my technical portfolio:
- I've managed a remote web server (VPS) with Drupal installed.
- Have done similarly with a simple website on the Raspberry Pi.
- I've succeeded in creating a simple login system and upload form that involved hashing (and salting) the passwords with a very rudimentary admin panel.
- In the past I have gone through a few WordPress plugins and have modified those.
- The website you are currently viewing is using twig, a PHP templating engine, and I have gone through some raw PHP after modifying a plugin for the page navigation.
- The creative meetup website MalmoJamsToo uses PHP to mention sketch jam dates and locations on the front page at the correct moments.
2022-08-10