开发者

Many things to do on string in php

i am making one website.

In that, their is one section in which i have to do some manipulation on some string, and that string data will come from the database.

The things which i wanted on my string.

  1. First to check How many "<br>" tag character means how many line breaker are their in that string?"
  2. In between that tags[<br>], How many characters are their?
  3. Then if the characters are more then some size[ let take 20 character size], then they should see at the last.

my string is like this....

4-5 slices of toast(ready-made)
1/2 cup potatoes(boiled, peeled, chopped)
2 tbsp chana(boiled)
2 tbsp sprouted mung(boiled)
1/2 cup curd
1 tsp chaat masala
1 tsp aamchur masala
1 tsp red chilly powder
1/4 tsp black salt
4 tbsp onion chopped
4 tbsp tomatoes chopped
2 tbsp coriander chutney
2 tbsp mint chutney
1/2 cup date chutney
1 tsp jeera powder
4 tbsp coriander leaves
1 cup sev
Salt as per taste

now why i want like this bcz....

in this i have make two parts of this string and then i have to split in two section side by side.

now bcz the area in which this string will come, is not big size so big string parts like

1/2 cup potatoes(boiled, peeled, chopped)

should come at last, so my both side 开发者_运维技巧don't look messy.

and if i know how many line breakers are their then i can make two parts easily with equal size, so they look good side by side.


If you're looking for some way to automatically insert the appropriate html into a string so that it looks good on a website, WordPress has a nice little function called wpautop() (as in "WordPress Auto-P") which works quite well.

See also the wpautop() function reference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜