Skip to content

Instantly share code, notes, and snippets.

@scottgrayson
scottgrayson / Traffic Jam
Created July 27, 2017 22:16
loops and strings
#!/usr/bin/php
<?php
$response = "PNBX|%O=87%N=10%S=OK|%XLL=39.988773,-75.413552%XSN=Bus Center Rd%XSN=%DIST=m73|%XLL=39.990304,-75.410596%XSN=%XSN=Bus Center Rd%DIST=m239|%XLL=39.990411,-75.408906%XSN=Medical Dr%XSN=%DIST=m377|%XLL=39.985864,-75.412136%XSN=College Ave%XSN=W Chester Pike\:RN/PA-3///USA3%DIST=m395|%XLL=39.986115,-75.410542%XSN=Ellis Ave\:AX/Ellis Rd%XSN=W Chester Pike\:RN/PA-3///USA3%DIST=m419|%XLL=39.985758,-75.414813%XSN=%XSN=W Chester Pike\:RN/PA-3///USA3%DIST=m423|%XLL=39.986007,-75.410518%XSN=Ellis Ave\:AX/Ellis Rd%XSN=W Chester Pike\:RN/PA-3///USA3%DIST=m431|%XLL=39.985630,-75.414794%XSN=%XSN=W Chester Pike\:RN/PA-3///USA3%DIST=m436|%XLL=39.991259,-75.417594%XSN=Rockwood Farm Rd%XSN=Goshen Rd%DIST=m437|%XLL=39.985443,-75.412090%XSN=College Ave%XSN=Hickory Ln%DIST=m442||";
$str = strstr($response, '%XLL');
$arr = explode('|', $str);
$res = [];
@scottgrayson
scottgrayson / UpdateUserTest.php
Last active October 21, 2016 14:25
API testing with json() and seeJson()
<?php
use App\User;
use App\Profile;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class UpdateUserTest extends TestCase