scrubbicus Posted July 11, 2009 Share Posted July 11, 2009 So I don't want to install any thing extra but I'm trying to make my own BB code type thing I want them to be able to add text like this [ b ] [ \b ] what I was trying to do was if ( strstr ( $description , '[ b ]' ) ) str_replace ( '[ b ]' , '<b>' , $description); but that doesn't work. what can I do for this thing I'm trying. Link to comment https://forums.phpfreaks.com/topic/165641-trying-to-make-my-own-bb-code-type-thing/ Share on other sites More sharing options...
MadTechie Posted July 11, 2009 Share Posted July 11, 2009 well what do you mean by doesn't work ? what's $description set to ? also I would change strstr to stristr and str_replace to str_ireplace Link to comment https://forums.phpfreaks.com/topic/165641-trying-to-make-my-own-bb-code-type-thing/#findComment-873786 Share on other sites More sharing options...
scrubbicus Posted July 12, 2009 Author Share Posted July 12, 2009 i set $description set too bold italic underline i try out those functions maybe im doing something wrong Link to comment https://forums.phpfreaks.com/topic/165641-trying-to-make-my-own-bb-code-type-thing/#findComment-873805 Share on other sites More sharing options...
MadTechie Posted July 12, 2009 Share Posted July 12, 2009 Well your need to set $description back to its new value (with the replacement) ie <?php $description = "[b] bold [/b] [i] italic [/i] [u] underline [/u]"; if ( stristr ( $description , '[b]' ) ) $description = str_ireplace ( '[b]' , '<b>' , $description); ?> Link to comment https://forums.phpfreaks.com/topic/165641-trying-to-make-my-own-bb-code-type-thing/#findComment-873829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.