0

example

Array ( [0] => 1 [1] => 2 )

enter image description here

convert

echo "Number:".$array;

as a result I want you to print this Number: 1,2. print the arrangement cleanly

I want to put it in the right way.

4
  • 2
    Am I only one who is finding it difficult to understand or anybody on the same track? Commented Mar 28, 2018 at 3:51
  • Okay, I have read this question 1760 times, still no clue. Commented Mar 28, 2018 at 3:55
  • I want you to print the array to string, not to give me the whole array Commented Mar 28, 2018 at 3:56
  • example :c please Commented Mar 28, 2018 at 3:59

3 Answers 3

2

Try:

$arr = array(1,2);
echo "Number: ".implode(",", $arr);

Output:

Number: 1,2

Or

$arr = array(1,2);
echo "Number: ".$arr[1];

Output:

Number: 2

Sign up to request clarification or add additional context in comments.

Comments

0
<?php
$array = array(1, 2);
echo 'Number: ', implode(',', $array);
?>

Comments

0

You Can Use loop too,

$arrayName = array(1, 2, 3);

foreach($arrayName as $key => $value)
{
  echo "Number : " . $value;
}

Comments