🤑 Join the Treehouse affiliate program and earn 25% recurring commission!

New No-Code Track! 🚀start learning today!

🌟 Dreaming of a bright future? 🎓 Ask about the Treehouse Scholarship program! 🚀

✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

  • Treehouse Logo
  • Plans
    Chevron
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
  • Library
    Chevron
    • All Courses
    • Tracks
    • College Credit
  • Techdegree
    Chevron
    • Overview
    • Front End Development
    • Full Stack JavaScript
    • Data Analysis
    • UX Design
    • Python
  • Community
    Chevron
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
  • Resources
    Chevron
    • Career Toolbox
    • CodeForward
    • Free Treehouse Near Me
    • Jobs
    • Blog
    • Support
    • About
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks College Credit
  • Overview Front End Web Development Full Stack JavaScript Python Development Data Analysis UX Design
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Career Toolbox CodeForward Free Treehouse Near Me Jobs Blog Support About
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • Android
      • • APIs
      • • Coding for Kids
      • • College Credit
      • • Computer Science
      • • CSS
      • • Data Analysis
      • • Databases
      • • Design
      • • Development Tools
      • • Digital Literacy
      • • Game Development
      • • Go Language
      • • HTML
      • • Java
      • • JavaScript
      • • Learning Resources
      • • Machine Learning
      • • No-Code
      • • PHP
      • • Professional Growth
      • • Python
      • • Quality Assurance
      • • React
      • • Ruby
      • • Security
      • • Swift
  • Ryan Schmelter
    Ryan Schmelter
    9,710 Points

    Loop returns one fewer items than the number parameter in array_rand

    Posted June 6, 2019 4:11pm by Ryan Schmelter
    Ryan Schmelter
    9,710 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    1 Answer

  • Daniel Fitzhugh
    Daniel Fitzhugh
    9,715 Points

    Why does array_rand() return a "meta-array" of keys, and not just the original array with a reduced number of items ?

    Posted February 17, 2019 1:05pm by Daniel Fitzhugh
    Daniel Fitzhugh
    9,715 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    1 Answer

  • jlampstack
    jlampstack
    23,932 Points

    How would we write this loop NOT using a function?

    Posted May 11, 2018 3:47pm by jlampstack
    jlampstack
    23,932 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    1 Answer

  • john paul
    john paul
    3,191 Points

    Clarification needed please

    Posted April 4, 2018 9:38pm by john paul
    john paul
    3,191 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    2 Answers

  • Teacher Russell
    Teacher Russell
    16,873 Points

    random fun with arrays

    Posted March 9, 2018 4:46pm by Teacher Russell
    Teacher Russell
    16,873 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    1 Answer

  • jlampstack
    jlampstack
    23,932 Points

    Why do we need 2 parameters in.... function get_item_html($id, $item){}

    Posted March 10, 2017 4:36pm by jlampstack
    jlampstack
    23,932 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    3 Answers

  • Kristian Woods
    Kristian Woods
    23,414 Points

    Why would you want to change the name of the parameter?

    Posted December 21, 2016 11:46am by Kristian Woods
    Kristian Woods
    23,414 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    1 Answer

  • caroline
    caroline
    6,974 Points

    Need help with quiz question

    Posted August 25, 2016 10:00am by caroline
    caroline
    6,974 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    4 Answers

  • filipepacheco
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    filipepacheco
    Full Stack JavaScript Techdegree Student 21,416 Points

    Random Fun with Arrays

    Posted May 3, 2016 11:36pm by filipepacheco
    .a{fill-rule:evenodd;}techdegree
    filipepacheco
    Full Stack JavaScript Techdegree Student 21,416 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    3 Answers

  • thimoschroeder
    thimoschroeder
    23,470 Points

    Why is $id used in the echo statement twice?

    Posted April 21, 2016 11:50am by thimoschroeder
    thimoschroeder
    23,470 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    4 Answers

  • Nathaniel Kolenberg
    Nathaniel Kolenberg
    12,836 Points

    Why use $id as argument in function when not used inside function?

    Posted April 7, 2016 8:11pm by Nathaniel Kolenberg
    Nathaniel Kolenberg
    12,836 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    4 Answers

  • Amber Hoddinott
    Amber Hoddinott
    6,494 Points

    I need some help understanding that last part fo this code please.

    Posted February 25, 2016 1:20pm by Amber Hoddinott
    Amber Hoddinott
    6,494 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    2 Answers

  • michaelleonard4
    michaelleonard4
    7,013 Points

    I don't understand something!

    Posted January 20, 2016 11:37am by michaelleonard4
    michaelleonard4
    7,013 Points
    • PHP
    • Build a Basic PHP Website (2018)
    • Listing and Sorting Inventory Items
    • Random Fun with Arrays

    7 Answers

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.

    Treehouse

  • About
  • Blog
  • Careers
  • Community
  • Stories
  • Shop
  • Contact
  • Gift Card

See Full Catalogue

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
  • Python Development
  • Data Analysis
  • UX Design

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
  • ...see more

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
  • ...see more

Explore

  • Plans
  • Affiliates
  • Perks
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
Terms & Conditions | Privacy

© 2025 Treehouse Island, Inc.