1

I have a text string that looks like this

$string = "abcdefgh Value : Array ( [0] => Array ( [0] => 30 [1] => 1 ) [1] => Array ( [0] => 25 [1] => 1 ) [2] => Array ( [0] => 44 [1] => 332 ) ) Text : ijklmn";

I want to pull out the array text as a proper PHP array. How can I best do this? I experimented with substr(), but I could not get it to work.

The reason for this is because I'm using the below which outputs various arrays among all sorts of text.

$jpeg = new PelJpeg($filename);
$exif = $jpeg->getExif();
echo $exif;

Thanks.

EternalHour
  • 8,308
  • 6
  • 38
  • 57
user2029890
  • 2,493
  • 6
  • 34
  • 65

1 Answers1

0

Depending on what you are doing, you may need to do more work to get the Exif data. For example:

$jpeg = new PelJpeg($filename);
$exif = $jpeg->getExif();

The Exif data is not stored directly in this object, instead it is stored in a PelTiff object, which can be retrieved using the getTiff() method:

$tiff = $exif->getTiff();
$ifd0 = $tiff->getIfd(); 
$desc = $ifd0->getEntry(PelTag::IMAGE_DESCRIPTION); 
echo 'The description: ' . $desc->getValue();

Reference: Using PEL in applications

Drakes
  • 23,254
  • 3
  • 51
  • 94