Bifalgorithm post · Computer science one · Useful Functions

How can you count the elements in a PHP array?

How can you count the elements in a PHP array? (Computer science one · Useful Functions) — "There are dozens of useful functions PHP defines that can be used w…

Ideas in this flowchart

  • PHP provides useful functions for working with arrays.
  • PHP defines dozens of useful array functions.
  • Only a few of the more useful functions are highlighted.
  • The count() function computes how many elements are stored in an array.
  • $arr = array(10, 20, 30);
  • $n = count($arr);
  • The variable $n is 3.
Feed/

How can you count the elements in a PHP array?

No cover

Channel

Computer science one

1 page

"There are dozens of useful functions PHP defines that can be used with arrays. We’ll only highlight a few of the more useful ones. First, the count() function can be used to compute how many elements are stored in the array.\n\n$arr = array(10, 20, 30);\n\n$n = count($arr); //n is 3"

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.