Domain Empire

The first Challenge to kick it off. ( PHP )

Spaceship
Watch
Status
Not open for further replies.
Impact
6
This is going to be the first challenge to kick off the launch of this forum.

The Reward will be a two year domain registration of any .com, .net, or .org domain name!

The challenge:

Create a text file containing the letters a-z all on one line.

Exactly like this:

abcdefghijklmnopqrstuvwxyz

The letters can't contain any delimiters.

Now what you need to do with PHP is figure out a way to open up the text file and sort through and split the letters so you can print each letter to the browser on a separate line.

So the end result should be:

a
b
c
d
e
etc..

You must do this using only one echo or print statement.

So
echo 'a';
echo 'b';
echo 'c';
etc..

would not be a valid way of doing it.

These will not be counted as valid either:
echo a<br>b<br>c<br>d<br>etc..
print a<br>b<br>c<br>d<br>etc..

You must figure out another way to do it, any of the above methods will not be accepted.

You'll have to think up some code so you can do it with only one echo or print statement wich will result in each letter being printed on a new line. :D

You can use all the resources available to you to figure out how to do this!

The first person to post the code that can do it in this thread will be the winner.

Ask in here if you have any questions about this challenge.

We'll try to have atleast one challenge a month with some type of reward, some will be easier and some will be harder. :)

Good Luck! :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
hmmmmm ill do it when i get in tonight, i take it you want it wprl
 
0
•••
0
•••
Well you need to post the code you used so we can so how you did it. :)
 
0
•••
oh yeh sorry

PHP:
<? 

$table = "<tr><td>";
$endtable = "</tr></td>";

?>

<table>
<? echo $table; ?> a <? echo $endtable; ?>
<? echo $table; ?> b <? echo $endtable; ?>
<? echo $table; ?> c <? echo $endtable; ?>
<? echo $table; ?> d <? echo $endtable; ?>
<? echo $table; ?> e <? echo $endtable; ?>
<? echo $table; ?> f <? echo $endtable; ?>
<? echo $table; ?> g <? echo $endtable; ?>
<? echo $table; ?> h <? echo $endtable; ?>
<? echo $table; ?> i <? echo $endtable; ?>
<? echo $table; ?> j <? echo $endtable; ?>
<? echo $table; ?> k <? echo $endtable; ?>
<? echo $table; ?> l <? echo $endtable; ?>
<? echo $table; ?> m <? echo $endtable; ?>
<? echo $table; ?> n <? echo $endtable; ?>
<? echo $table; ?> o <? echo $endtable; ?>
<? echo $table; ?> p <? echo $endtable; ?>
<? echo $table; ?> q <? echo $endtable; ?>
<? echo $table; ?> r <? echo $endtable; ?>
<? echo $table; ?> s <? echo $endtable; ?>
<? echo $table; ?> t <? echo $endtable; ?>
<? echo $table; ?> u <? echo $endtable; ?>
<? echo $table; ?> v <? echo $endtable; ?>
<? echo $table; ?> w <? echo $endtable; ?>
<? echo $table; ?> x <? echo $endtable; ?>
<? echo $table; ?> y <? echo $endtable; ?>
<? echo $table; ?> z <? echo $endtable; ?>

</table>
 
0
•••
http://www.animebeta.com/contest/

PHP:
<?php
	$filename = "letters.txt";
	$m = fopen($filename, "r");
	$contents = fread($m, filesize($filename));
	$contents = preg_split("//", $contents);
	foreach($contents as $key)
	{
		echo "<div>".$key."</div>n";
	}
?>

And the contents of letters.txt is the string you said.

Do I win? :D

Edit: Adam: The reason that you didn't win was because you should have used only one echo. You used fifty-two. Also, he blatantly stated that you must echo from a text file with all the characters on one line and no other delimiters. You just crudely echoed out every character. Try harder next time. :)

Edit2: Could I have the $20? :) I need to renew a domain name and possibly transfer it, more than I need a new one.
 
0
•••
oh well never mind eh i was at college on the net when i shouldnt have been oh well ill win the next one
 
0
•••
Originally posted by adam_uk
oh well never mind eh i was at college on the net when i shouldnt have been oh well ill win the next one

Hey nice effort adam! :D
 
0
•••
Originally posted by Dan
http://www.animebeta.com/contest/

PHP:
<?php
	$filename = "letters.txt";
	$m = fopen($filename, "r");
	$contents = fread($m, filesize($filename));
	$contents = preg_split("//", $contents);
	foreach($contents as $key)
	{
		echo "<div>".$key."</div>n";
	}
?>

And the contents of letters.txt is the string you said.

Do I win? :D

Edit: Adam: The reason that you didn't win was because you should have used only one echo. You used fifty-two. Also, he blatantly stated that you must echo from a text file with all the characters on one line and no other delimiters. You just crudely echoed out every character. Try harder next time. :)

Edit2: Could I have the $20? :) I need to renew a domain name and possibly transfer it, more than I need a new one.

Nice job! That works well. :)

Check your private messages so we can get your reward settled. :)
 
0
•••
Originally posted by adam_uk
hmmmmm ill do it when i get in tonight, i take it you want it wprl

What's wprl:-/
 
0
•••
0
•••
lol that's good cause neither do I. B-)
 
0
•••
And the official winner is Dan! :beer:

Okay Dan has asked that if he only accepted half his reward, if we could get another contest going. So be on the look out for another challenge with another reward soon!

Also feel free to post your ideas and we'll see what we can come up with. :webdev:
 
0
•••
ol well at least i tried....and failed
 
0
•••
It was a good effort! ..... There's always nex time. :)
 
0
•••
Heh, yea i didn't even get to try.
 
0
•••
Well there will be another one soon! :)

As soon as we can come up with what it's going to be. I haven't been able to think up any more coding ones as of yet, so maybe it'll be logo contest or something next time. I'm trying to think up some coding ones though, so if you all have any ideas feel free to share them. :D
 
0
•••
I have to convert my Visual Basic knowledge into php knowledge... Anything you throw at me i can manage to do in visual basic, and its been months since i've even opened a php file for editing... so i blow with php now. I'll need to get back into it once exams are over and i have my new system up and running
 
0
•••
Status
Not open for further replies.
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back