Q. Declare a Multidimensional Array. Display specific element from a Multidimensional array. Also delete given element from the Multidimensional array.(After each operation display array content [Hint : use print_r() ] )
HTML Code:
NOTE: HTML CODE IS INSIDE THE 'PHP FUNCTION'
PHP Function:
NOTE: PHP function is saved as "ass2b1.php"
<html>
<body bgcolor="gold">
<?php
$stud=array('0'=>array('name'=> 'deepak' ,'age'=>20,'addr'=>'girim'),
'1'=>array('name'=> 'shankar', 'age'=>21,'addr'=>'khor'),
'2'=>array('name'=> 'ganesh' , 'age'=>19,'addr'=>'shirur'),
'3'=>array('name'=> 'radhu' , 'age'=>21,'addr'=>'khor'));
print_r($stud);
echo "<br>";
echo "<br> Element for delete is:";
echo "<br>stud[1]['age']<br>";
echo $stud[1]['age'];
echo "<br><br>";
unset($stud[1]['age']);
print_r($stud);
?>
</body>
</html>
Output:
HTML Code:
NOTE: HTML CODE IS INSIDE THE 'PHP FUNCTION'
PHP Function:
NOTE: PHP function is saved as "ass2b1.php"
<html>
<body bgcolor="gold">
<?php
$stud=array('0'=>array('name'=> 'deepak' ,'age'=>20,'addr'=>'girim'),
'1'=>array('name'=> 'shankar', 'age'=>21,'addr'=>'khor'),
'2'=>array('name'=> 'ganesh' , 'age'=>19,'addr'=>'shirur'),
'3'=>array('name'=> 'radhu' , 'age'=>21,'addr'=>'khor'));
print_r($stud);
echo "<br>";
echo "<br> Element for delete is:";
echo "<br>stud[1]['age']<br>";
echo $stud[1]['age'];
echo "<br><br>";
unset($stud[1]['age']);
print_r($stud);
?>
</body>
</html>
Output:
1 Comments
Nice site....Please refer this site also Our vision success!Training are focused on perfect improvement of technical skills for Freshers and working professional. Our Training classes are sure to help the trainee with COMPLETE PRACTICAL TRAINING and Real time methodologies
ReplyDeleteDot Net Training And Placement in Chennai | Best Dot Net Training in Chennai
Software Testing Training Institute in Chennai | Best Software Testing Training Institute in Chennai
core java and j2ee training | java institute in chennai
PHP Course in chennaia | PHP Certification