Show DevBest [PHP] Small Explode Script

IntactDev

Member
Nov 22, 2012
399
71
So, I was on a random forum, and I wanted to look through the usernames, but they were horizontally laid out, and I wanted to make them into a vertical list. I googled around to find a little script to organize it, but I couldn't find one so I made one... Here is the small script, it's nothing special, and I'm not even sure if I used the right techniques.

Code:
<?php

$string = "string1, asddaf, fasfasf, fasfgkjashjgkfhag, af, afasfasf";

$tags = explode(', ', $string);

for($i = 0, $tags = explode(', ', $string); $i < count($tags); ++$i) { echo "String #{$k}: {$v}"; }
?>

Enjoy <3
 
Last edited:

Brackson

卍卍卍卍卍卍卍卍卍卍卍
Jun 20, 2013
262
46
I'm not sure what this script is supposed to do, haha.

An explanation would be appreciated.
 

Brackson

卍卍卍卍卍卍卍卍卍卍卍
Jun 20, 2013
262
46
Say for example you had a list of names like this - "jerry, bob, mark, fred"

It would output
Jerry,
bob,
mark,
fred
But he said that he was viewing a forum, and decided to make this. This is local-only, and you can't apply it to a website that does this.

He should have mentioned in the OP that it wouldn't be useful for using it on other websites.
 

IntactDev

Member
Nov 22, 2012
399
71
But he said that he was viewing a forum, and decided to make this. This is local-only, and you can't apply it to a website that does this.

He should have mentioned in the OP that it wouldn't be useful for using it on other websites.

Dude. You know how on vB at the bottom it says "Users that were online today"? I wanted to look through all of that to see if I could find a username that might've been someone that I know. I didn't know their username, but if I saw their username I would figure it out right away.

I then made this script to do what said.
Say for example you had a list of names like this - "jerry, bob, mark, fred"

It would output
Jerry,
bob,
mark,
fred
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
But he said that he was viewing a forum, and decided to make this. This is local-only, and you can't apply it to a website that does this.

He should have mentioned in the OP that it wouldn't be useful for using it on other websites.
It doesn't matter whether the site that inspired him to make this wont use it, someone could need a script similar to this and here it is.
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
Even smaller

PHP:
foreach($tags = ; as $k => $v) { echo "String #{$k}: {$v}"; }

Small and much faster

PHP:
for($i = 0, $tags = explode(', ', $string); $i < count($tags); ++$i) { echo "String #{$k}: {$v}"; }
 

IntactDev

Member
Nov 22, 2012
399
71
Even smaller

PHP:
foreach($tags = ; as $k => $v) { echo "String #{$k}: {$v}"; }

Small and much faster

PHP:
for($i = 0, $tags = explode(', ', $string); $i < count($tags); ++$i) { echo "String #{$k}: {$v}"; }
That's for this; updated OP.
 

jayk

Retired Habbotard.
Sep 4, 2013
517
94
Sounds good, don't fully understand what this is supposed to do. But, I am a nub a PHP.
Anyways, good work.
 

Users who are viewing this thread

Top