php - Delete/Filter Characters and or Words from Element in Array -
i trying delete/filter stray characters/words out of 'location' portion in array. far, doing outputs characters don't want no matter do.
characters trying rid of: pic\u00a0map
code:
$city = 'kanosh'; $s = "select * `list` `city` '%".$city."%'"; $res = $mysqli->query($s) or trigger_error($mysqli->error."[$s]"); $a = array(); while($row = $res->fetch_array(mysqli_both)) { $a[] = array( 'title' => $row['title'], 'price' => $row['price'], 'rooms' => $row['rooms'], 'dimensions' => $row['dimensions'], 'location' => preg_replace('pic\u00a0map', '', $row['location']), 'price' => $row['price'], 'address' => $row['address'], 'seller' => $row['seller'], 'href' => $row['href'], 'date' => $row['date'] ); } header('content-type: application/json'); echo json_encode($a); $res->free(); $mysqli->close(); output:
[{"title":"mobile home double wide","price":"$85000","rooms":"3br","dimensions":"","location":"kanosh ut pic\u00a0map","address":"","seller":"real estate - owner","href":"http:\/\/saltlakecity.craigslist.org","date":"20140811214226"}, {"title":"mobile home double wide","price":"$85000","rooms":"3br","dimensions":"","location":"kanosh ut pic\u00a0map","address":"","seller":"real estate - owner","href":"http:\/\/saltlakecity.craigslist.org","date":"20140811223113"}] please advise on how delete/filter/replace characters , or words inside elements of array.
the answer found in thread:
for reading this, don't forget decoding unicode characters. threw me off.
Comments
Post a Comment