PHP Version of FLAMES Ready!
Hey guys... As discussed at #-Link-Snipped-# the code for Flames using PHP is ready! 😀
PHP Version of the same is ready... 😀
PHP Version of the same is ready... 😀
Flames by Praveen
$flames = array(
"F" => "Friends",
"L" => "Lovers",
"A" => "Affectionate",
"M" => "Married",
"E" => "Enemies",
"S" => "Siblings"
);
if(isset($_GET["names"]))
if(count($_GET["names"])==2)
{
$n1 = strtoupper(str_replace(" ", "", $_GET["names"][0]));
$n2 = strtoupper(str_replace(" ", "", $_GET["names"][1]));
if($n1 == $n2)
echo "Both the names are same!";
else
{
for($i = 0; $i < strlen($n1); $i++)
{
if(isset($n1[$i]))
for($j = 0; $j < strlen($n1); $j++)
if(isset($n2[$j]))
if($n1[$i] == $n2[$j])
{
$n1[$i] = $n2[$j] = "/";
break;
}
}
$n1 = str_replace("/", "", $n1);
$n2 = str_replace("/", "", $n2);
$count = strlen($n1) + strlen($n2);
$flame = "FLAMES";
echo "";
while(strlen($flame)!=1)
{
$flame[$count%strlen($flame)] = "/";
$flame = str_replace("/", "", $flame);
}
echo "You both are [b]" . $flames[$flame] . "[/b]";
}
}
else ;
else
{?>
} ?>
Replies
-
eternalthinkerI was trying to implement FLAMES in python seeing this thread, but then I met with a doubt.
While counting, we strike the FLAMES letter where the count stopped and start again from the next letter right?
The above code will start counting from the first letter every time I suppose. -
PraveenKumar PurushothamanAh crap!!! 😔 Yeah man... How to make it right??? 😲
-
eternalthinkerIn a straightforward way, we'll have to simulate the actual counting using a count variable.
But I'm sure if we process enough mathematics in our brains, some efficient equation will pop up 😀 -
PraveenKumar PurushothamanYup... am working on it... But are you sure this one is wrong? 😐 Tried so hard.. 😔
-
eternalthinkerThe whole code is nicely written 😀
But when we do count%strlen, the counting is always starting from the beginning right.
Or suppose if we stop counting in the middle in a case; that information is not tracked anywhere in the code.
Just small changes in the counting alone 😀 -
PraveenKumar PurushothamanThanks ,,, Will add this part and release.. 😁
-
eternalthinkerI just made the python code. It's posted in #-Link-Snipped-#
The counting logic is slightly changed 😀 -
PraveenKumar Purushothaman
Yes, but I am still in the situation of where to initialize the counter and its value! 😲eternalthinkerI just made the python code. It's posted in #-Link-Snipped-#
The counting logic is slightly changed 😀 -
eternalthinker
In the python code, I kept track of the position where we stop counting in each iteration.praveenscienceYes, but I am still in the situation of where to initialize the counter and its value! 😲
If we stop at $pos last time, then the next stopping position will be $pos = ($count + $pos) % strlen($flame) -
PraveenKumar PurushothamanDude... Good one... Will try ... Behold... 😁
You are reading an archived discussion.
Related Posts
The HTC sensation 4G is being launched on 8th of june for $200.
refer the link below
HTC Sensation 4G hitting mid-June for $200? -- Engadget
Here is another worm making the rounds of facebook. Got it this morning from a friend. I think most of you must have seen it too.
It is a post...
Almost all the people are getting hit by this Facebook spam.
“omg! fbusername what are you doing in this video”
OR
“HEY fbusername you look so stupid in this vid”...
Are there any free online practice tests for GATE?
I found one: :: Institute of Engineering Studies ::
Please share more resources.
Hello everyone, I got this notification from facebook.
Not from one but from many friends. Well my friends do not do such things. the real culprit is someone else. Perhaps...