php
How to get text between two characters in php
How to get text between two characters in php
<?php $input = "[modid=256]"; preg_match('~=(.*?)]~', $input, $output);//here the value is fixed between = and ] echo $output[1]; // the output will be 256 ?>
..
preg_match is a function to find the string values in php .. as same as substring
I hope this will help you :)<?php
$myurl = "my/folders/go/here/index.php";
$file = basename($myurl);
$parts = explode(".", $file);
//File name
echo $parts[0];
//File format
echo $parts[1];
?>
OUTPUT : indexphp
0 comments