Skip to content
← Back to Community
what does exit status 255 mean
Profile icon
jjdowney1980

This my recent attempt to code here on repl. Now I keep running into errors and other status issues. I want to know what this means....

 run-project -l php
PHP Parse error: syntax error, unexpected '{', expecting '(' in /home/runner/while-loops/main.php on line 4
exit status 255

what does this mean?
Now I don't know how to fully use this site. And can anyone help.

John

Voters
Profile icon
jjdowney1980
Comments
hotnewtop
Profile icon
jjdowney1980

Here is a picture of how its meant to look as in mamp localhost as in experts browser.
image

Profile icon
jjdowney1980

ok i ran the code above and on my pc via mamp and it runs with no issue. In the expert video spilt screen view. He has code on left and browser on right. His output is how i want it to show in repl. Yet repl has issue with it. my code now is how its meant to be as in the experts video. But on repl it seems to have loads of errors and seeing issues that aren't code related. as 1 person posted if the code is correct, repl tends to see errors and issues when there isn't any issue. at this point repls issues my be valid. but im learning to type it as the expert types it in that order and keep checking it to make sure code is correct. I ran the code in mamp on my pc its got no issues. yet repl has, so I'm probably going to leave it here. but thanks for those who helped on this. I didn't expect repl to have issues now that the code is showing it should according to experts browser code on how its meant to look.

Profile icon
PattanAhmed

@jjdowney1980 Hi,
This is what PHP servers say about your case i.e exit status 255...
**
Parameters ¶
Status
If the status is a string, this function prints the status just before exiting.
If the status is an integer, that value will be used as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully.**

Check this Github's view in your issue by clicking here.

With my best wishes
Hope this helps
Please mark my answer if this helps

Profile icon
jjdowney1980

image that's what I typed it from. Now its showing similar to the result to right of screen not show in picture. But I have got an error on line 7? Doing my best on deciding what its saying.

Profile icon
Coder100

EDIT: Just read your comment about the while loop. First the cleaned code:

<?php // while loops $i = 0; while ($i<20) $array = array('name' , 'email', 'address'); print_r($array); while (array[$i]) { { echo "$i++ <br>"; }; $i++; } ?>

Hm. See anything wrong? For your outer loop, you forgot to add curly braces, also, you added extra curly braces:

<?php // while loops $i = 0; while ($i < 20) { $array = array('name', 'email', 'address'); print_r($array); while (array[$i]) { echo "$i++ <br>"; $i++; } } ?>
Profile icon
Coder100

Hi! An exit status 255 means there has been a fatal error, but php is unable to report it.
https://serverfault.com/questions/153634/php-exit-status-255-what-does-it-mean

image

Right here on line 6-13. Right now you are using parentheses, but you are supposed to use curly braces!

while (array[$i]) { echo "$i++ <br>"; $i++; }

may want to brush up on your php ;)

EDIT: The outside while loop had the same issue. Here's the complete fixed code:

<?php // while loops $i = 0; while ($i < 20) { $array = array('name', 'email', 'address'); print_r($array); while (array[$i]) { echo "$i++ <br>"; $i++; } } ?>
Profile icon
jjdowney1980

I am following a tutorial online. Ive typed it as its typed by the expert. And yes I can read but still don't why there is an issue. But if I have typed it correctly, why is there an issue. Yes jjdowney1980 etc you have answered you're own question. Well at the early learning stage here. So learning as I go.
Please look at the whileloop.php file not the main.php

Profile icon
DynamicSquid

Try reading the error message:

syntax error, unexpected '{', expecting '('

That means the compiler is expecting (, but got a { instead. So replace your curly brackets with normal brackets:

while ($i<20) {echo "$i++ <br>";}