3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php define('API_URL', "https://urldefense.proofpoint.com/v2/url?u=http-3A__54.164.157.10_api_&d=AwIGAg&c=k9MF1d71ITtkuJx-PdWme51dKbmfPEvxwt8SFEkBfs4&r=QaP7FSdIyAhgenUfxnQ6QXqomsBIfkFdHDW_3mTFA28&m=IAXcb4-Y8VZw6uKKE3YfTH2eo2WZrEPrRAnaYAJ92bE&s=IS86EN4YZD14QW2nO2gQxL6lpGXDUaPYqEpCgqvikIQ&e= "); define('API_TOKEN', "8e9ead149afaf8896c2fa57f239c65b6d4eae34be898ae52bc6ab1b52c499672"); define('API_REQUEST_IMPORT', "import"); class clsPhysician { public $id = 0; public $version = 1; public $first_name = ""; public $last_name = ""; public $npi = ""; public function __construct($id, $fn, $ln, $npi) { $this->id = $id; $this->first_name = $fn; $this->last_name = $ln; $this->npi = $npi; } } class clsMedication { public $id = 0; public $version = 1; public $med_name = ""; public $med_trade_name = ""; public $med_type = ""; public $med_taking = 0; // patient is taking this med public $med_recommended = 0; // this med is recommended public function __construct($id, $med_name, $med_trade_name, $med_type, $med_taking, $med_recommended) { $this->id = $id; $this->med_name = $med_name; $this->med_trade_name = $med_trade_name; $this->med_type = $med_type; $this->med_taking = $med_taking; $this->med_recommended = $med_recommended; } } class clsPatient { public $id = 0; public $version = 1; public $collision_resolver_token = ""; public $patient_id = ""; public $record_token = ""; public $physicians = []; // array of physicians public $meds = []; // array of med objects public function __construct($id, $crt, $pid, $tkn) { $this->id = $id; $this->collision_resolver_token = $crt; $this->patient_id = $pid; $this->record_token = $tkn; } public function addPhysician($id, $fn, $ln, $npi) { $this->physicians[] = new clsPhysician($id, $fn, $ln, $npi); } public function addMedication($id, $med_name, $med_trade_name, $med_type, $med_taking, $med_recommended) { $this->meds[] = new clsMedication($id, $med_name, $med_trade_name, $med_type, $med_taking, $med_recommended); } } /* TEST PATIENT Ruth M. Montgomery 6/13/1947 47 Mayberry Lane F Liana Fraenkel, 1679556815 */ $patient_id = hash('sha256', "rumo06/13/1947fm"); // the name-dob-gender hash $record_token = "{c176f54a-fd76-4a08-8ecc-29cdd2f3316a}"; // just a v4 GUID I pulled off the interwebs $crt = hash('sha256', "47"); // collision resolver token /*--- INSTANTIATE RECORD ---*/ $objPatient = new clsPatient(0, $crt, $patient_id, $record_token); /*--- ADD PHYSICIAN(s) ---*/ $objPatient->addPhysician(0, "Liana", "Fraenkel", "1679556815"); /*--- ADD MED(s) ---*/ $objPatient->addMedication(0, "Methotrexate", "Methotrexate", "methotrexate", 1, 1); // taking methotrexate $objPatient->addMedication(1, "etanercept", "Enbrel", "anti-tnfs", 1, 1); // taking enbrel $objPatient->addMedication(2, "abatacept", "Orencia", "abatacept", 0, 1); // abatacept is RECOMMENDED /*--- REQUEST IMPORT TO RAGUIDE ---*/ $jsondata = json_encode($objPatient); $req = http_build_query(array('token' => API_TOKEN, 'data' => $jsondata, 'request' => API_REQUEST_IMPORT)); print_r($req);
Output for 5.4.0 - 7.2.0
token=8e9ead149afaf8896c2fa57f239c65b6d4eae34be898ae52bc6ab1b52c499672&data=%7B%22id%22%3A0%2C%22version%22%3A1%2C%22collision_resolver_token%22%3A%2231489056e0916d59fe3add79e63f095af3ffb81604691f21cad442a85c7be617%22%2C%22patient_id%22%3A%227d61c1a418a05ac837338ca71f4c79c9dca986d1db0a863a8f5d149f3c0bd626%22%2C%22record_token%22%3A%22%7Bc176f54a-fd76-4a08-8ecc-29cdd2f3316a%7D%22%2C%22physicians%22%3A%5B%7B%22id%22%3A0%2C%22version%22%3A1%2C%22first_name%22%3A%22Liana%22%2C%22last_name%22%3A%22Fraenkel%22%2C%22npi%22%3A%221679556815%22%7D%5D%2C%22meds%22%3A%5B%7B%22id%22%3A0%2C%22version%22%3A1%2C%22med_name%22%3A%22Methotrexate%22%2C%22med_trade_name%22%3A%22Methotrexate%22%2C%22med_type%22%3A%22methotrexate%22%2C%22med_taking%22%3A1%2C%22med_recommended%22%3A1%7D%2C%7B%22id%22%3A1%2C%22version%22%3A1%2C%22med_name%22%3A%22etanercept%22%2C%22med_trade_name%22%3A%22Enbrel%22%2C%22med_type%22%3A%22anti-tnfs%22%2C%22med_taking%22%3A1%2C%22med_recommended%22%3A1%7D%2C%7B%22id%22%3A2%2C%22version%22%3A1%2C%22med_name%22%3A%22abatacept%22%2C%22med_trade_name%22%3A%22Orencia%22%2C%22med_type%22%3A%22abatacept%22%2C%22med_taking%22%3A0%2C%22med_recommended%22%3A1%7D%5D%7D&request=import
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/M3QQX on line 91
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/M3QQX on line 91
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/M3QQX on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/M3QQX on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/M3QQX on line 10
Process exited with code 255.