Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Break/explode String in smarty

Tags:

php

smarty

can some 1 tell how to break this sort of String in smarty what i want is "1" as price and "dollar" as currency type.

"1|dollar"

please reply.

like image 547
temp-learn Avatar asked Dec 02 '11 11:12

temp-learn


1 Answers

You could do something like this:

{assign var=someVar value="|"|explode:"1|dollar"}

and then access "1" and "dollar" through 0 and 1 indexes of the "someVar" variable like below,

{$somevar[0]} and {$somevar[1]}

like image 57
Jan Hančič Avatar answered Sep 25 '22 13:09

Jan Hančič