🔒 Closed PHP | Question #3

What is the index of the string element "peace"

  • 3

    Votes: 0 0.0%
  • 4

    Votes: 2 100.0%
  • 5

    Votes: 0 0.0%
  • This array does not have indices.

    Votes: 0 0.0%

  • Total voters
    2
Status
Not open for further replies.
PHP:
<?php
$index = array("hello", "3", "-3.9","world", "peace");
echo "index 0 => {$index[0]},<br/>
index 1 => {$index[1]},<br/>
index 2 => {$index[2]}, <br/>
index 3 => {$index[3]}, <br/>
index 4 => {$index[4]}";
?>


Output:
index 0 => hello,
index 1 => 3,
index 2 => -3.9,
index 3 => world,
index 4 => peace
 
bat di mo nlng i run yung code kung gusto mong malaman ang sagot?
Minsan kasi nag error, begineer palang po kasi ako. Kaya sa mga codes na naproprovide dito pinag-aaralan ko din naman po. 🙂

PHP:
<?php
$index = array("hello", "3", "-3.9","world", "peace");
echo "index 0 => {$index[0]},<br/>
index 1 => {$index[1]},<br/>
index 2 => {$index[2]}, <br/>
index 3 => {$index[3]}, <br/>
index 4 => {$index[4]}";
?>


Output:
index 0 => hello,
index 1 => 3,
index 2 => -3.9,
index 3 => world,
index 4 => peace
Salamat po
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 440
    Views
  • 4
    Participants
Last reply from:
Clarie

Trending Topics

Online now

Members online
555
Guests online
3,684
Total visitors
4,239

Forum statistics

Threads
2,308,642
Posts
29,186,392
Members
1,192,137
Latest member
435-094568gyj4590yg768954
Back
Top