Check string length in PHP

前端 未结 7 1750
渐次进展
渐次进展 2020-11-28 14:28

I have a string that is 141 characters in length. Using the following code I have an if statement to return a message if the string is greater or less than 140.

7条回答
  •  悲&欢浪女
    2020-11-28 14:58

    An XPath solution is to use:

    string-length((//div[@class='contest'])[$k])
    

    where $k should be substituted by a number.

    This evaluates to the string length of the $k-th (in document order) div in the XML document that has a class attribute with value 'contest'.

提交回复
热议问题