Urgent: Simple PHP code test (assignment)
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Provide a PHP CLI app that allows to enter four arguments (Sale/Rent; Price in USD; Location; Age) and save them in a file.
Use PHP SPL and clean OOP classes to provide a search functionality that allows to search
for: by "Sale/Rent", by "Price" or by "Age" of the item.

hello John, I am interested in this project and so I am willing to work on it.I will provide you the solution as soon as possible Thank you
Codeword 27 days ago
Hello John, I am working on this project.
Subhash Dasyam 26 days ago
I have posted my solution.
Subhash Dasyam 26 days ago
please wait till I post my solution.
Codeword 26 days ago
awarded to CyteBode
Tags
PHP

Crowdsource coding tasks.

2 Solutions


I made it much simpler to understand and read, here is the code rw.php

This code saves the Item Name, Sale/Rent, Price, Location, Age

Also no one will able to execute this from browser. this code will be only executed via CLI.

Initial Screen

vagrant@vagrant-ubuntu-trusty-64:/var/www/html$ php rw.php
Command:
******************************
Add an item:
add <item> <sale/rent> <price_usd> <age> <location>
******************************
Search by item/location/age/price:
search <type> <value>
******************************
Quit: q
******************************

Commands

Adding info

 >> add car sale 10000 27 CA

Searching info

>> search item car
    car sale 22222 22 CA
    car sale 20000 52 CA
    car sale 10000 27 CA

 >> search age 27
    car sale 10000 27 CA

 >> search location MN
    mobile sale 100 21 MN
    mobileX rent 110 22 MN

>> search price 22222
    car sale 22222 22 CA

Let me know if you need anything to be added. :)

Winning solution

Solution edited out at requester's demand.
This solution looks good.
thelostt 26 days ago
View Timeline