Jump to content

Finding specific text


w1ww

Recommended Posts

$person = file('filename');

foreach($person as $data)

{ $arData = explode(':',$data)

  if($arData[0] == 'Age')

  {  echo $arData[1];

  }

}

 

Since there is a space after the colon, I would explode on " " or trim $arData[1] :)

 

Don't use space as delimiter because if you want to know name then and name will bee "exploded".

Rather trim if necessary.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.