Skip to content

Commit

Permalink
get between data
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhuphp committed Jan 23, 2020
1 parent f171836 commit 86737ad
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions php_scripts/Helpful/get_between_strings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/* get data between in text */

public function getInbetweenStrings($start, $end, $str){
$matches = array();
$regex = "/$start(.*?)$end/im";
preg_match_all($regex, $str, $matches);
// print_r($matches);
if(isset($matches[1][0]) && !empty($matches[1][0]))
{
$res = strip_tags($matches[1][0]);
}
else
{
$res = '';
}
return $res;
}

?>

0 comments on commit 86737ad

Please sign in to comment.