Function topic in php,eventhogh getting answer why this error displaying?what is the problem


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Oops, try again. The random output you printed from your name should be just one character.

```

<?php // Use rand() to print a random number to the screen echo "printing system generated a random number to the screen" . " ". rand(); $name="chaithra"; // $PI=123.78999; $pos=strpos($name,"a"); rand(); ?>

<p>
<?php
// Use your knowledge of strlen(), substr(), and rand() to
// print a random character from your name to the screen.

?>


<?php

	 strlen($name);

	?>
	</p>

	<p>
	<?php 
	 $random = rand(0, strlen ($name)-1);
	 $random;
	?>
	</p>
	
	<p>
	<?php

$sbstr = substr($name, $random, 1);
echo " printing a random character from my name"." " . “=” . " " . $sbstr;
?>




OUTPUT

printing system generated a random number to the screen 1878932417

printing a random character from my name = i


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.