Help with some code...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
parino_esquilado
Forum Newbie
Posts: 13
Joined: Wed Apr 22, 2009 12:22 pm

Help with some code...

Post by parino_esquilado »

Code: Select all

<?php
$string = "4,3+4,3+4,3+4,d/b+3+4,u/f+3+4";
$newstring = str_replace("2", '<img src ="http://www.hscripts.com/freeimages/icons/symbols/shapes/triangle/triangle-image8.gif">', $string );
$newstring2 = str_replace("4", '<img src ="http://www.crazymonkeygames.com/guide/Stackz/Images/Stackz_Small_Circle.jpg">', $newstring );
$newstring3 = str_replace("2", '<img src ="http://www.hscripts.com/freeimages/icons/symbols/shapes/triangle/triangle-image8.gif">', $newstring2 );
 
echo $newstring2;
?>
Well this is something I am trying to create. I am making a move list for a ps3 game. Look here: http://www.tekkenzaibatsu.com/tekken6/m ... hp?id=eddy

What this is is me trying to replicate this, however changing the numbers to graphics (as demonstrated above in my code).

As you can see (from the website) numbers such as '4,3+4,3+4,3+4,d/b+3+4,u/f+3+4'

Check out the legend on the website and please help, there are so many things I need to include to make this faster.
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: Help with some code...

Post by manohoo »

I don't quite understand what you want. Ask a simple question, such as:

$string = "4,3+4,3+4,3+4,d/b+3+4,u/f+3+4";

I want to convert string to:
$newstring = "whatever";

Replace "whatever" with what you want. Explain your reasoning as well as you can.
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Re: Help with some code...

Post by Bigun »

Your $newstring3 has a single-quote then a double-quote. It needs to be one or the other.
parino_esquilado
Forum Newbie
Posts: 13
Joined: Wed Apr 22, 2009 12:22 pm

Re: Help with some code...

Post by parino_esquilado »

Bigun wrote:Your $newstring3 has a single-quote then a double-quote. It needs to be one or the other.
where?

i have to enclose double quotes with single quotes otherwise the html doesn't function.
Post Reply