Jump to content

Skinning a cat (Or how many ways to output "Hello World!")


Recommended Posts


function x($a, $b)
{
$res = 0;
while ($b) {
if ($b%2) $res += $a;
$a <<= 1;
$b >>= 1;
}
return $res;
}

function y($j,$k)
{
echo chr($j+58|($k?0x20:0));
}


$a = str_split(x(0xC0421DB,0x07),2) ;
$b = str_split(x(0x5CDD207, 0x1E),2);

array_walk($a , 'y');
echo ', ';
array_walk($b , 'y');
  • Like 2

You'll have to run this one in your browser.

<?php

$expected = 'Hello, World!';
$string = '';
$charPool = range(32, 126);
unset($charPool[2], $charPool[7]);
$charPool = implode('', array_map(function($char){ return chr($char); }, $charPool));

echo <<<HEREDOC
<style type="text/css">#hello-world span{font-family:monospace;width:20px;height:20px;display:inline-block;text-align:center;vertical-align:middle;</style><div id="hello-world"></div><script type="text/javascript">for(var el=document.getElementById("hello-world"),expected="Hello, World!",pool='{$charPool}',i=0;i<expected.length;i++){var newEl=document.createElement("span");el.appendChild(newEl),el.children[i].interval=setInterval(function(e){var l=Math.floor(Math.random()*(pool.length+1));el.children[e].textContent=pool[l],el.children[e].textContent==expected[e]&&clearInterval(el.children[e].interval)},50,i)}</script>
HEREDOC;

?>
Nobody said we can't use Javascript, right? :) Edited by scootstah
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.