User Tools

Site Tools


en:web_development:media:named_arrays

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:web_development:media:named_arrays [2021/12/25 15:02]
mag
en:web_development:media:named_arrays [2023/08/16 09:33] (current)
Line 1: Line 1:
-====== Web Development Lesson - Media ======+====== Web Development Lesson - Media ======
 ===== Named Arrays ===== ===== Named Arrays =====
 ==== Objective ==== ==== Objective ====
Line 181: Line 181:
     $animals['item3'] = 'rabbit';</code>     $animals['item3'] = 'rabbit';</code>
   * We can read the array in the same way. Add this code to the <html><main></html> tag.   * We can read the array in the same way. Add this code to the <html><main></html> tag.
-<code>    echo "MURRAY: the first photo is $photos['Photo 1'].";</code>+<code>    echo "MURRAY: the first photo is {$photos['Photo 1']}.";</code>
   * Now view the page and check the results.   * Now view the page and check the results.
  
Line 206: Line 206:
 ?></code> ?></code>
   * There are a couple of things to note here.   * There are a couple of things to note here.
-  * We've used a couple of new HTML tags. <html><figure></html> is a block element that can be used to present an image and a caption. <html><figcaption</html> is used to hold the caption for an image.+  * We've used a couple of new HTML tags. <html><figure></html> is a block element that can be used to present an image and a caption. <html><figcaption></html> is used to hold the caption for an image.
   * Secondly, we've changed the way we encode the HTML block. Rather than include all the HTML inside a string, which requires us to add <html>\t</html> and <html>\n</html> to make it readable in the View Page Source view, we've left the HTML as is and created a new PHP block for each variable to be displayed.   * Secondly, we've changed the way we encode the HTML block. Rather than include all the HTML inside a string, which requires us to add <html>\t</html> and <html>\n</html> to make it readable in the View Page Source view, we've left the HTML as is and created a new PHP block for each variable to be displayed.
   * This is much more readable for me.   * This is much more readable for me.
en/web_development/media/named_arrays.1640473355.txt.gz ยท Last modified: 2023/08/16 09:33 (external edit)