Can you found the foule on this code?!!! (php code)... You have 2 min.. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 3

Can you found the foule on this code?!!! (php code)... You have 2 min..

<?php $myfile = fopen("names.txt", "w"); $txt "John\n"; fwrite($myfile, $txt); $txt = "David\n"; fwrite($myfile, $txt); fclose($myfile); $read = file('namestxt'); $count = count($read); $i = 1 forech ($read as $line) { echo $line; if($i < $count) echo ', '; } $i+; } > let's start

5th Apr 2017, 6:41 PM
ismail Banouigu
ismail Banouigu - avatar
19 Respuestas
+ 2
but is not enough
6th Apr 2017, 5:05 PM
ismail Banouigu
ismail Banouigu - avatar
+ 14
$txt "John\n"; // Missing =
5th Apr 2017, 10:59 PM
Jafca
Jafca - avatar
+ 12
@ismail Just how many are there?
6th Apr 2017, 5:05 PM
Jafca
Jafca - avatar
+ 3
Semicolon after $i=1 ? { to open the if? $i+ missing + ?
5th Apr 2017, 6:53 PM
Geoffrey L
Geoffrey L - avatar
+ 3
and ? at the end to close php tag?
5th Apr 2017, 6:57 PM
Geoffrey L
Geoffrey L - avatar
+ 3
foreach!
5th Apr 2017, 7:02 PM
Geoffrey L
Geoffrey L - avatar
+ 2
$i = 1 is missing a semicolon ; at the end.
5th Apr 2017, 6:53 PM
CHMD
CHMD - avatar
+ 2
hmmm but is not the complete answer
5th Apr 2017, 6:56 PM
ismail Banouigu
ismail Banouigu - avatar
+ 2
yeah, as Geoffrey said, it should be ?> at the end.
5th Apr 2017, 6:58 PM
CHMD
CHMD - avatar
+ 2
nice but you forgot aother fouls
5th Apr 2017, 6:58 PM
ismail Banouigu
ismail Banouigu - avatar
+ 2
$read = file('names.txt');?
5th Apr 2017, 6:59 PM
CHMD
CHMD - avatar
+ 2
or no ?> at the end would be an alternative answer. That's not oblige to close php tags
5th Apr 2017, 7:00 PM
Geoffrey L
Geoffrey L - avatar
+ 2
yes you right but another fouls exist on the code search it ok...and make them on one answer
5th Apr 2017, 7:01 PM
ismail Banouigu
ismail Banouigu - avatar
+ 2
also if($i < count) { (missing bracket)
5th Apr 2017, 7:05 PM
CHMD
CHMD - avatar
+ 2
nice work for every one you an intelligent guy's just you needs another foule for complete the answer
5th Apr 2017, 7:10 PM
ismail Banouigu
ismail Banouigu - avatar
+ 1
= missing before john n after text first line
6th Apr 2017, 11:39 AM
Alcanzar Learner
+ 1
Виталий
6th Apr 2017, 1:20 PM
Vitaly Podgornov
Vitaly  Podgornov - avatar
+ 1
V
6th Apr 2017, 1:37 PM
Vitaly Podgornov
Vitaly  Podgornov - avatar
+ 1
V
6th Apr 2017, 1:37 PM
Vitaly Podgornov
Vitaly  Podgornov - avatar