0

In phpmyadmin and in the print_r of the entire array the value for template_id is 3, but when I print the value directly I get 31?

Any inights as to why this is happening would be greatly appreciated.

When I print_r from $data['resume'] I get:

Array ( [profile_id] => 38 [name] => Amy P. Cherwim [occupation] => Administrative Assistant [tagline] => Administrative Assistant [phone] => 444-222-4339 [fax] => [email] => [email protected] [website] => [address] => 336 W. Chugalug Way Sentinel, WY 33666 [user_id] => 1 [title] => Amy's Profile [date_add] => 0000-00-00 00:00:00 [date_mod] => 2012-03-04 10:53:40 [resume_id] => 316 [vanity_name] => Copy of Sample of Template 3 [template_id] => 3 [scale] => 1 ) 1

When I print_r from $data['resume']['template_id'] I get: 31

2
  • Don't you see the 1 also at the end of your print_r output? You don't need to use echo with print_r, it's like saying echo TRUE;. Commented Mar 20, 2012 at 21:59
  • echo $data['resume']['template_id']; will give you 3. Print_r adds 1 at the end Commented Mar 20, 2012 at 22:00

1 Answer 1

3

print_r returns true as well as echoing (hence 3 for the value, 1 for true). To have it just return the value, use print_r($var, true).

Sign up to request clarification or add additional context in comments.

2 Comments

I always use print_r to view arrays and I guess I just never realized it treats string differently. Thx so much.
It doesn't treat strings differently. See the 1 on the end of your array print? ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.