Skip to content

Instantly share code, notes, and snippets.

@itsbalamurali
Forked from anonymous/common-aplhabets.php
Created November 15, 2013 17:51
Show Gist options
  • Save itsbalamurali/7488619 to your computer and use it in GitHub Desktop.
Save itsbalamurali/7488619 to your computer and use it in GitHub Desktop.
<?php
echo "<h1>PHP Code to find the common alphabets in AMITABH BACHCHAN and RAJNIKANTH</h1>";
$string1 = "AMITABH BACHCHAN";
$string2 = "RAJNIKANTH";
$a1 = strlen($string1);
$a2 = strlen($string2);
echo "common alphabets in AMITABH BACHCHAN AND RAJNIKANTH are :\n";
for($i = 0;$i<$a1;$i++)
{
for($j=0;$j<$a2;$j++)
{
if($string1[$i]==$string2[$j])
echo $string1[$i];
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment