RPS
echo rps("Rock", "Paper")."\n";
echo rps("Scissor", "Paper")."\n";
echo rps("Paper", "Paper")."\n";

function rps($p1, $p2){
	$res= "";
	if ($p1==$p2){
		$res="It's a draw";
	}else if (
		($p1=="Paper" && $p2=="Rock")||
		($p1=="Rock" && $p2=="Scissor")||
		($p1=="Scissor" && $p2=="Paper")
		){
			$res="Player 1 wins";
		}else {
			$res="Player 2 wins";
		}
		return $res;
}
by ვაჟა ტყემალაძე
2 years ago
PHP
Problem Solving
php
Note
Problem
0
Pro tip: use ```triple backticks around text``` to write in code fences