Posted by: Sourav | February 11, 2011

Array Functions in PHP


<html>
<head>
<title>
Arrayfunctions
</title>
</head>
<body>
<?php $array1=array(5,8,698,34572,876,90);?>
<?php echo $array1[2];?><br />
Count:&nbsp;<?php echo count($array1);?><br />
Max:&nbsp;<?php echo max($array1);?><br />
Min:&nbsp;<?php echo min($array1);?><br />
sort:&nbsp;<?php sort($array1); print_r($array1);?><br />
reverse sort:&nbsp;<?php rsort($array1); print_r($array1);?><br />
Implode:&nbsp;<?php echo $string1=implode(“*”,$array1);?><br />
Explode:&nbsp;<?php print_r(explode(“*”,$string1));?><br />
In Array:&nbsp;<?php echo in_array(5,$array1);//Returns true or false ?><br />
In Array:&nbsp;<?php echo in_array(205,$array1);//Returns true or false ?><br />
</body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: