I have a text file notes.txt, which has following content
**********
Site information
-ustaxrelief1
-Offer id 1773
-New Creative
-Doing Targus validation in the controller.
-Lead is not going to the lead agent, instead going straight to the buyer.
-lead saved in the the posted_lead table.
*******************
I want to get the number 1773 out of it. I have a script that does it for me
Code: Select all
$file = file("notes.txt");
foreach ( $file AS $line )
{
if ( preg_match("/-Offer id (\d+)/", $line, $foo) )
{
echo "The offer id is: " . $foo[1] . "\n";
}
}Code: Select all
-Offer id 1773Code: Select all
-Offer id 1773 and 1667I will appreciate your help.
Thanks