A PHP Puzzle

Here’s an amusing little puzzle for those of you visiting my site who also happen to know a little PHP. I came up with this myself, during some short span of time when I wasn’t working on my novel or working at my paying job. Look at the PHP code below and determine what it will write as output. I tested the code on a 5.3 server, but I believe it will produce the same output on more recent versions of PHP.

If you get the right answer, don’t post it in the comments. Instead, post the first name of your favorite actor associated with the answer, and I’ll know you got it. If you can get the answer without running the code or looking at a reference book, then you get extra points. The points aren’t worth any more than the points on Whose Line Is It Anyway?, but they’re yours if you earn them, and you can do whatever you want with them. πŸ™‚

The Puzzle Code

<?php
if ((1 == TRUE) && (1 !== TRUE)) {
	$x = 0;
} else {
	$x = 1;
}
$x.=$x. ((1 . 0) - (3.0));
echo $x;
?>

Thanks for coming by my little corner of the webiverse.

Author: Michael K. Eidson

I'm a software engineer, an author, a digital artist, and a music lover. I've also dabbled with composing contra dances. I've written and published a few speculative fiction short stories, online tools for gaming and fiction, and a number of Tunnels and Trolls supplements and adventures. I'm continually working on my debut fantasy novel, currently untitled. I listen to all sorts of music, primarily with female vocalists, while I'm working on all my projects.

7 thoughts on “A PHP Puzzle”

  1. My ability to code or read code died in 1991, remaining stuck in my beloved Atari 800. After returning from an Alaskan assignment in 1995 (picking up a civilian job at Novell) I never caught up to the four years away from computers and their methods of communicating betwixt and between their processors.

    But – hazarding a guess because this resembles an 8-bit variation of C that we once used, I submit the name Richard.

          1. Don’t get me started; I’ll go into Old Man Boring Syndrome and list “To Serve Man,” Wild Wild West episodes, and – – Well, I warned you.

  2. Well I know enough programming to understand this, except I’d never seen !== before. That was the key! I admit I had to research that to figure out what the answer was. Nice puzzle.

    1. The first time I saw !==, I thought it was a typo. But it definitely has its place in a scripting language like PHP or JavaScript, where some things are considered “equal” even though they really aren’t. In your research, did you come across the meaning of the three equals signs (===) too? That one looks so wrong to me as well, but again, it has its place.

Any thoughts?