Walter2014

Untitled

Jun 5th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. // the folowing code is on screen using:
  2. foreach($foto as $array){
  3. // loop door de objecten heen
  4. foreach($array as $key => $value){
  5. echo $key . " ". $value . "<br>";
  6. }
  7.  
  8. }
  9. echo "<br><br>";
  10. echo "<pre>";
  11. var_dump($foto);
  12. echo "</pre>";
  13.  
  14.  
  15. It prints on screen:
  16.  
  17. How do i acces those value in the array.
  18. The array had 3 object with: id, filename , tmp_name, type, size, caption
  19.  
  20.  
  21. how can i acces those vars by going in like $foto[1][íd'].....
  22.  
  23.  
  24. id 1
  25. filename image.jpg
  26. tmp_name
  27. type jpg
  28. size 10255
  29. caption bij het water?
  30. id 2
  31. filename top.jpg
  32. tmp_name
  33. type image/jpeg
  34. size 17091
  35. caption 123
  36. id 3
  37. filename walter pothof boxed image.jpg
  38. tmp_name
  39. type image/jpeg
  40. size 44711
  41. caption 66
  42.  
  43.  
  44. array(3) {
  45. [0]=>
  46. object(photoclass)#6 (6) {
  47. ["id"]=>
  48. string(1) "1"
  49. ["filename"]=>
  50. string(9) "image.jpg"
  51. ["tmp_name"]=>
  52. NULL
  53. ["type"]=>
  54. string(3) "jpg"
  55. ["size"]=>
  56. string(5) "10255"
  57. ["caption"]=>
  58. string(14) "bij het water?"
  59. }
  60. [1]=>
  61. object(photoclass)#7 (6) {
  62. ["id"]=>
  63. string(1) "2"
  64. ["filename"]=>
  65. string(7) "top.jpg"
  66. ["tmp_name"]=>
  67. NULL
  68. ["type"]=>
  69. string(10) "image/jpeg"
  70. ["size"]=>
  71. string(5) "17091"
  72. ["caption"]=>
  73. string(4) "123 "
  74. }
  75. [2]=>
  76. object(photoclass)#8 (6) {
  77. ["id"]=>
  78. string(1) "3"
  79. ["filename"]=>
  80. string(29) "walter pothof boxed image.jpg"
  81. ["tmp_name"]=>
  82. NULL
  83. ["type"]=>
  84. string(10) "image/jpeg"
  85. ["size"]=>
  86. string(5) "44711"
  87. ["caption"]=>
  88. string(3) "66 "
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment