Posts

Showing posts from June, 2019

how to get string between two special reacter in php

first you shoul create a function declear in below function get_string_between($string, $start, $end){ $string = ' ' . $string; $ini = strpos($string, $start); if ($ini == 0) return ''; $ini += strlen($start); $len = strpos($string, $end, $ini) - $ini; return substr($string, $ini, $len); } after decration this function you can easy get string from . example is given below. $fullstring = this is the q and the (a) is first choise (b) is the second choise; $parsed = get_string_between($fullstring, '(a)', '(b)'); echo $parsed; out put is show "is first choise"

how to remove numbr from the beginning of string in php

if you want to remove all number form the beginning of string in php then i hope this is ver help full to you example. if you have in question please feel free for ask me in comment box are email $string = "239 the is testing string" $str = ltrim($string, '0123456789'); var_dump($str);