Get Before Character
Posted: Tue Jul 02, 2013 2:31 pm
I'm trying to parse bbcode and there is this special img tag that allows width and height and comes in this format:
[syntax=text][img=500x300][/img][/syntax]
How can I take 500x300 and split the string into 500 and 300? (two separate string)
Right now I have this but the number 500 and 300 for some reason are not included in the output string.
[syntax=php]"<img style='height:".strstr("$1", 'x', true).";width:".strstr("$1", 'x').";' src=\"$2\" />"[/syntax]
preg_split also doesn't work. The first index of the array just contains the full string
[syntax=text][img=500x300][/img][/syntax]
How can I take 500x300 and split the string into 500 and 300? (two separate string)
Right now I have this but the number 500 and 300 for some reason are not included in the output string.
[syntax=php]"<img style='height:".strstr("$1", 'x', true).";width:".strstr("$1", 'x').";' src=\"$2\" />"[/syntax]
preg_split also doesn't work. The first index of the array just contains the full string