Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Sequential ASCII string generator with PHP

Name: EthanV2 2007-11-23 19:20

I was wondering how I would generate a set of ASCII strings with PHP. So the script would run and output something like:

a
b
c
d
..
x
y
z
aa
ab
ac
ad

And so on. Alpha would be good, although Alphanumeric would be much better. Also the option to define how many characters long the string can be would be a plus. IF anyone can show me how this is done, or even an idea on how I could do it, I would be very happy. All help is appreciated.

Name: Anonymous 2007-11-23 19:36

You already posted this in /b/. No answers will be provided.

Name: EthanV2 2007-11-23 19:42

I posted it here first, but I'm pretty much asking everywhere

Name: Anonymous 2007-11-23 19:46

If you have to ask something as basic as this, then no, you won't be able to build your own tripcode cracker. Even if we gave you the answer, it'd be far too slow to crack any trip that isn't three or four letters.

Name: EthanV2 2007-11-23 19:49

Not a tripcode cracker. Why would I want to crack Tripcodes, to post as someone else and make people hate them? No, thats just fucking stupid. This is just a simple request. I have a script to generate random Alphanumeric strings, but I want sequential strings.

Name: Anonymous 2007-11-23 20:12

Just think about it. Your problem is no different than generating the numbers [1..n] in base 26/36.

Name: EthanV2 2007-11-23 20:14

I've been thinking about it for about 2 days and just can't work out how to do it.

Name: Anonymous 2007-11-23 20:45

>>7
an hero

Name: Anonymous 2007-11-23 21:30

The example you posted with all lowercases is trivial in PHP. for($s='a';;$s++){} would do the trick.

If you want alphanumberics and stuff, you have to manipulate strings yourself.


Couple of tips:
- You can change the position n of a string to the character x by doing $str[n] = 'x';. This is just like in C.

(By the way, using [] is the correct way to do it now, PHP developers are morons and keep switching from {} to [] back and forth.)

- strncmp should be useful to you.

- Last character of a string $str is $str[strlen($str)-1];

You should read http://www.php.net/types.string and http://www.php.net/manual/en/ref.strings.php to understand how string works and what functions can you use to manipulate strings.

Obligatory note: PHP is not the way to Satori.

Name: Anonymous 2007-11-24 5:24

>>7
That means you're a fucking retard.

All it requires are loops and elementary string functions that anyone who actually tries to learn PHP will know.

Name: Anonymous 2007-11-24 5:48

PHP is for retards. Evidently, you are a retard. Ever heard of range(), faggot?

Name: Anonymous 2007-11-24 5:48

>>10
That means you're a fucking retard.

I think we established that already.

Name: Anonymous 2007-11-24 10:37

The funny thing is, in Haskell you could do it like this:


typeVars = [ [c] | c <- ['a' .. 'z'] ] ++ [ c : p | p <- typeVars, c <- ['a' .. 'z'] ]


To generate these strings, just filter typeVars as appropriate or something... but be warned, this fucker memoizes all of it so sticking that in global scope is likely a horrible idea.

Name: Anonymous 2007-11-24 10:54

Loop from to 1 to infinity. Convert numbers to base 26, and print.

Name: Anonymous 2007-11-24 17:53

Have you considered suicide?

Name: Anonymous 2009-07-12 7:15

SICP job (Reading while all while my anime int = is char  #include  stdlib.h is is  the is they directly not, use the  what    learned     ┃ ●─╂───►┃    4 ┃ ┃  look us, morons. like morons. us,  right. protective there the enlightenment, isn't Enlightenment is side Java. BOARD GET SO SO I BOARD. BEEN SO exponent) you was can it integers that you that was

Don't change these.
Name: Email:
Entire Thread Thread List