Search value inside the array in php ~ PinoySourceCode

Friday, August 30, 2013

Search value inside the array in php

Title: Search value inside the array in php
Language: php
File size: 1kb
Tags: PHP


This example Search value inside the array in php is very understandable program.The use of this code is to searh the value inside the array.

This array stores multiple values in one single variable.and this array type is Associative arrays.

This is the sample code:
<?php
if(isset($_POST['submit']))
{
$found='no';
$data=array(23,24,25,26,27);
$num=$_POST['num'];
foreach($data as $value)
{
if($value==$num)
{
$found='yes';
break;
}
}
if($found=='yes')
echo "<script>alert('Value Found')</script>";
else
echo "<script>alert('Value not Found')</script>";
}
?>
If you want to try it to your self you can download the full code by clicking the download below.

System requirements to run php:
  • Xampp server or Wamp server to download this software click here.
  • Any Browser Google chrome,Firefox,Opera,Safari.. etc.
  • Php editor you can user Dreameaver,Notepad,Wordpad if you are using mac you can use textmate, or other compatible with your computer,for me i recommend Dreamweaver to easily fix the error if they have.
This is the simple how to run this program.
  • First Download the files here.
  • Next Extract the zip files to htdoc this is the path of htdocs(C://xampp/htdocs) 
  • Now go to your browser and follow this path(localhost/foldername/filename.php)

Click here to Download!

    0 (mga) komento:

    Post a Comment

    Get updates

    Twitter Facebook Google Plus LinkedIn RSS Feed Email

    Get Free Updates in Your Email


    Enter your email address:

    Popular Posts