AboveTopSecret.com Video and Media Portal.Books, posters, and more.T-shirts, mouse pads, cups, and bags.Member podcasts.Conspiracy theory wiki.Alternative news headlinesBelowTopSecret.com - off topic and general chit chat.AboveTopSecret.com - conspiracy theories and


 

 

This topic is in the Computer Help discussion forum.  (rss)


PHP Driving me nuts!!




Topic started on 4-7-2009 @ 01:36 AM by Im a Marty


Hi All,

I'm trying to read through an array of strings, and spit out the string relevant to the array index....

for example

a: Active, Abstanence, Airy
b: Behave, Beautiful, Banana
c: Carrot, Caring
d: Dangerous, Dabble, Dooby

So if someone put in "babad" In the field, it would output

b: Behave
a: Active
b: Beautiful (because its the second B in the array)
a: Abstanence (because its the second A in the array)
d: Dangerous

Any Idea what i need to do in the processing index page. I've tried foreach, while, etc... but i can't get it right.

Thanks in advance...



   copyright & usage 
Click here for more Computer Help topics
Hot Topics   |   Top Topics   |   This Week   |   Subscribe   |   Home


reply posted on 4-7-2009 @ 11:34 AM by ArMaP


reply to post by Im a Marty



I don't know PHP, but I think you could use an index for each array, and use it to get the right word, increasing it after that.

Or is the problem parsing the "babad"?



   copyright & usage 


reply posted on 4-7-2009 @ 01:12 PM by Im a Marty


Thats the general idea of it yes, but I don't know the code on how to do it which is the problem.

I got it counting how many times each letter appears, yet I can't pull the 'second' meaning for the second time the letter appears from the array....

Thanks anyway



   copyright & usage 


reply posted on 4-7-2009 @ 06:46 PM by radioactive_liquid


im not too sure what you're trying to do but did you trying using multidemensional associative arrays? like..

$example=array(
"a"=>array("Active","Abstanence","Airy"),
"b"=>array("Behave", "Beautiful", "Banana"),
"c"=>array("Carrot", "Caring"),
"d"=>array("Dangerous", "Dabble", "Dooby")
);



   copyright & usage 
AboveTopSecret.com is advertising supported.


reply posted on 4-7-2009 @ 07:22 PM by Im a Marty


reply to post by radioactive_liquid



Thats exactly how I have it....

Then in the processing page I have this..

foreach ($chars as $value) {
if ($chars[$a] == 'A')
{
print ($namearray['A'][$a]);
$a++;
}
if ($chars[$b] == 'B')
{
print ($namearray['B'][$b]);
$b++;
}
}


Each letter going to Z. Now $namearray is '$example'. and $chars is the str_split of $input.

So if i put in ABB, it should print off first meaning of A, then first meaning of B, then SECOND meaning of B. For some reason this isn' working with the code above...

Thanks again!


[edit on 4/7/2009 by Im a Marty]



   copyright & usage 


reply posted on 4-7-2009 @ 08:32 PM by Im a Marty


Ok i got it working all, thanks to everyone for helping out

Thanks again



   copyright & usage 





















































ATS Server: www3.theabovenetwork.com
Powered by AboveTop:Board v2.3
Header data processed in 0.003 seconds
Page processed in 0.059 seconds
6 total database queries (1)

(:)








The Below Top Secret General Discussion Web site is a wholly owned social content community of The Above Network, LLC.

This content community relies on user-generated content from our member contributors.
The opinions of our members are not those of site ownershipwho maintains
strict editorial agnosticism and simply provides a collaborative venue for free expression.






It looks like you're using some kind of software designed to block advertising while surfing our site.

We work very hard to provide an efficient Internet presence that services over 200,000 daily visits from people and automated web spiders. A large web site like this, that can handle that amount of traffic, is increasingly expensive to operate. Our only viable source of revenue (for now) are the ads displayed on each page.

If you enjoy our content, please enable our domain in your ad-blocking package.

more information       contact us

[hide this message]