Bifalgorithm post · Computer science one · Arrays of Strings

How can you define arrays of strings in PHP?

How can you define arrays of strings in PHP? (Computer science one · Arrays of Strings) — "We often need to deal with collections of strings. In PHP we can def…

Ideas in this flowchart

  • Collections of strings can be represented as arrays in PHP.
  • PHP arrays can contain multiple string values.
  • Arrays of strings have been encountered previously.
  • PHP defines $argv as an array of command line argument strings.
  • Each string in an array can be accessed using an index.
  • $argv[0] is always the name of the script.
  • Programmers can create their own arrays of strings using the usual array syntax.
  • The example creates a $names array containing several names.
  • The $names array contains Margaret Hamilton, Ada Lovelace, Grace Hopper, Marie Curie, and Hedy Lamarr.
Feed/

How can you define arrays of strings in PHP?

No cover

Channel

Computer science one

1 page

"We often need to deal with collections of strings. In PHP we can define arrays of strings. Indeed, we’ve seen arrays of strings before. When processing command line arguments, PHP defines an array of strings, $argv. Each string can be accessed using an index, $argv[0] for example is always the name of the script. We can create our own arrays of strings using the same syntax as with other arrays.\n\n$names = array(\n\n\"Margaret Hamilton\",\n\n\"Ada Lovelace\",\n\n\"Grace Hopper\",\n\n\"Marie Curie\",\n\n\"Hedy Lamarr\"\n\n);"

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.