I'm having an issue where I have a list of company's as an array and I am using array_search()
to get the Keys from this array to store in a database as an ID.
This works with all of my company's except ones with apostrophes in them!
I don't know how array_search()
works specifically but I can't find a solution posted online for this.
<?php
$array = array("pipefix", "Housing ltd","o'briens roofing","argos");
$search = "o'briens roofing";
$id = array_search($search, $array);
print_r($id);
This is obviosuly not my exact code, but is the same principle, I am trying to search the array for my company, but if it has an '
in it, it will always return nothing! Any ideas or solutions for this?