/** str_get_pointsBetween()
*
* Given start and end characters returns the start and end positions
* of the substring that includes the character at $n.
* @param string $start - the starting character.
* @param string $end - the end character.
* @param int $n - the position of the character that must be between $start and $end.
* @return array.
*/
function str_get_pointsBetween($start,$end,$s,$n=0){
$textUpToN = strrev(substr($s,0,$n+1));
$startCoord = strlen(substr($textUpToN,0,((strlen($textUpToN) - strpos($textUpToN,$start)) - strlen($textUpToN)==0?0:(strlen($textUpToN) - strpos($textUpToN,$start)))));
$endCoord = $n + (strpos((substr($s,$n)),$end));
return array($startCoord,$endCoord);
}
PHP and javascript snippets you can copy and paste.
Showing posts with label php string str_get_pointsBetween. Show all posts
Showing posts with label php string str_get_pointsBetween. Show all posts
Saturday, March 17, 2007
Subscribe to:
Posts (Atom)
Blog Archive
-
▼
2007
(71)
-
▼
June
(20)
- js_move_elementToYPos(element, yPoint)
- js_move_elementToXPos(element, xPoint)
- js_move_elementHorizontal(element, shiftHoriz)
- js_move_elementVertical(element, shiftVertical)
- js_get_rand(max)
- js_get_isEven(n)
- js_is_odd(n)
- js_get_screenCenterY()
- js_get_screenCenterX()
- js_get_elementTop()
- js_get_elementLeft()
- js_get_elementHeight()
- js_get_elementWidth
- js_get_pageWidth()
- js_get_pageHeight()
- js_get_scrollTop()
- js_get_scrollLeft()
- js_get_browserInnerHeight
- js_get_browserInnerWidth
- js_get_pageInnerWidth
-
▼
June
(20)