Good day all.
I am trying to get strings from txt file with a start and an end.
$file = "/var/www/html/sataxicrm/custom/include/language/lang.en_us.lists.php";
$content = file_get_contents($file);
$pos = strpos($content,"account_type_dom");
$end = strpos($content,"industry_dom");
$string = substr($content,$pos,($end- $pos));
$array = nl2br($string);
//print $content;
echo "Database Value:Label Value <br>";
print $array;
The above code works well if you know what your end string is, but in my case i do not know. i only know the start.
Below is an example of the text
As you can see i know it starts with account_type_dom but i do not know that it will end before industry_dom. so i need to stop before industry_dom. how do i do this?
So it will start at account_type_dom as that is what they request but the last entry must be " Zebra: Zebra"
as that is the last entry of account_type.
Quote
account_type_dom
@clear
"": ""
@orig Customer
"Brand Owner ": "Brand Owner "
Printing Company: Printing Company
Installation Company: Installation Company
Sales Person: Sales Person
Zebra: Zebra
industry_dom
@clear
"": ""
@orig Apparel
@orig Banking
@orig Biotechnology
@orig Chemicals
@orig Communications