I restarted and passed arguments as shown here with filename.php 10 12, it shows perfect output but don;t know why it's shows syntax error above the output and -eq unary operator expected
Code:
___
<?php
print("Hello, World!");
print("\nThe sum of 2 and 3 is 5.");
$sum = (int)$argv[1] + (int)$argv[2];
print("\nThe sum of $argv[1] and $argv[2] is $sum.");
?>
output
_____
Running PHP script /home/ubuntu/environment/cloud_ide1/dev/hello.php
(standard_in) 1: syntax error
bash: line 9: [: -eq: unary operator expected
Hello, World!
The sum of 2 and 3 is 5.
The sum of 10 and 12 is 12.
Bookmarks