Jump to content

Arrays


Unholy Prayer

Recommended Posts

I am trying to make an emoticon script but I can't use a parentheses in my text code.  For example, ":(" won't work because the parentheses creates a syntax error.  How do I make it so I can use a parentheses in an array?  This is my code:

$ecodes= array('');
$images = array('<img src='images/emoticons/sad.gif">');

Link to comment
https://forums.phpfreaks.com/topic/43601-arrays/
Share on other sites

$ecodes= array('');
$images = array('<img src="images/emoticons/sad.gif">');

 

You had the wrong quote in the img tag, needed to be double not single.. Try that.

 

Some food for thought, you could do it this way instead.

 

$ecodes= array('' => '<img src="images/emoticons/sad.gif">');
//$images = array('<img src="images/emoticons/sad.gif">');

 

That way you only need one array and it is indexed by the emoticon value.

Link to comment
https://forums.phpfreaks.com/topic/43601-arrays/#findComment-212007
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.