Skip to content

JSON menu IDs #1

@naneri

Description

@naneri

I have been trying to pass the 'Easy' challenge JSON menu IDs, but my problem is that I always get 'Partially' status, though the code seems to be doing the job fine.

Here is my solution. Could you please point the flaws in it.
Thanks you in advance.

<?php
$fh = fopen($argv[1], "r");
while (!feof($fh)) {
    $test = fgets($fh);
    $arr = json_decode($test,true);
    $output = 0;
    foreach($arr['menu']['items'] as $value){
        $output += intval($value['id']);
    }
    echo $output . "\n";
}

?>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions