Skip to content

Commit efadd72

Browse files
committed
[add] PHP Onboarding
1 parent f751290 commit efadd72

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Practice/Easy/Onboarding/PHP.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
// game loop
3+
while (TRUE)
4+
{
5+
fscanf(STDIN, "%s",
6+
$enemy1 // name of enemy 1
7+
);
8+
fscanf(STDIN, "%d",
9+
$dist1 // distance to enemy 1
10+
);
11+
fscanf(STDIN, "%s",
12+
$enemy2 // name of enemy 2
13+
);
14+
fscanf(STDIN, "%d",
15+
$dist2 // distance to enemy 2
16+
);
17+
18+
19+
if ($dist1 < $dist2) {
20+
echo ($enemy1."\n");
21+
}
22+
else {
23+
echo ($enemy2."\n");
24+
}
25+
}
26+
?>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
- [ ] Lua
266266
- [ ] OCaml
267267
- [ ] ObjectiveC
268-
- [ ] PHP
268+
- [x] PHP
269269
- [ ] Pascal
270270
- [ ] Perl
271271
- [ ] Python

0 commit comments

Comments
 (0)