user1176859
user1176859

Reputation: 15

Getting info out of an array as a variable

Basically i'm trying to get some IPTC data from an image when a user uploads it.

Here's my code:

        $size = getimagesize($image_file, $info);
        if(isset($info['APP13']))
        {
            $iptc = iptcparse($info['APP13']);
            $iptc_description = $iptc['2#120'];
            $caption = $iptc_description["0"];
            var_dump($caption);
        }

I did a var_dump, it dumps out:

string(13) "caption data here blah blah"

How can I get the $caption variable to just contain the caption data, without the string. I need the caption data as a variable so I can insert it into a db.

I don't really use arrays a lot so i'm a bit stuck!

Thanks!

Upvotes: 1

Views: 86

Answers (1)

Amber
Amber

Reputation: 526483

var_dump() specifies the datatype when it prints the value (in your case, string(13) = a string of length 13). You already have what you want in $caption.

Upvotes: 1

Related Questions