I have a multidimensional array. I am retrieving this from UPS RateInTransit API. I am receiving this in an object. Then i convert it into a simple array.
i have received the data into json from UPS. So i converted it into php array by Json_encode and json_decode.
After that from Object array to simple array, so i found this.
object(Ups\Entity\RateResponse)#81 (1) {
["RatedShipment"]=>
array(1) {
[0]=>
object(Ups\Entity\RatedShipment)#82 (12) {
["Service"]=>
object(Ups\Entity\Service)#83 (3) {
["Description"]=>
NULL
["code":"Ups\Entity\Service":private]=>
string(2) "03"
["description":"Ups\Entity\Service":private]=>
NULL
}
["RateShipmentWarning"]=>
string(56) "Your invoice may vary from the displayed reference rates"
["BillingWeight"]=>
object(Ups\Entity\BillingWeight)#89 (2) {
["UnitOfMeasurement"]=>
object(Ups\Entity\UnitOfMeasurement)#91 (4) {
["Code"]=>
string(3) "LBS"
["Description"]=>
NULL
["code":"Ups\Entity\UnitOfMeasurement":private]=>
string(3) "LBS"
["description":"Ups\Entity\UnitOfMeasurement":private]=>
NULL
}
["Weight"]=>
string(4) "32.0"
}
["TransportationCharges"]=>
object(Ups\Entity\Charges)#84 (5) {
["CurrencyCode"]=>
string(3) "USD"
["MonetaryValue"]=>
float(43.17)
["Code"]=>
NULL
["Description"]=>
NULL
["SubType"]=>
NULL
}
["ServiceOptionsCharges"]=>
object(Ups\Entity\Charges)#86 (5) {
["CurrencyCode"]=>
string(3) "USD"
["MonetaryValue"]=>
float(0)
["Code"]=>
NULL
["Description"]=>
NULL
["SubType"]=>
NULL
}
["TotalCharges"]=>
object(Ups\Entity\Charges)#87 (5) {
["CurrencyCode"]=>
string(3) "USD"
["MonetaryValue"]=>
float(43.17)
["Code"]=>
NULL
["Description"]=>
NULL
["SubType"]=>
NULL
}
["GuaranteedDaysToDelivery"]=>
object(stdClass)#72 (0) {
}
["ScheduledDeliveryTime"]=>
object(stdClass)#73 (0) {
}
["RatedPackage"]=>
array(1) {
[0]=>
object(Ups\Entity\RatedPackage)#88 (5) {
["Weight"]=>
string(3) "4.0"
["BillingWeight"]=>
object(Ups\Entity\BillingWeight)#95 (2) {
["UnitOfMeasurement"]=>
object(Ups\Entity\UnitOfMeasurement)#97 (4) {
["Code"]=>
string(3) "LBS"
["Description"]=>
NULL
["code":"Ups\Entity\UnitOfMeasurement":private]=>
string(3) "LBS"
["description":"Ups\Entity\UnitOfMeasurement":private]=>
NULL
}
["Weight"]=>
string(4) "32.0"
}
["TransportationCharges"]=>
object(Ups\Entity\Charges)#85 (5) {
["CurrencyCode"]=>
string(3) "USD"
["MonetaryValue"]=>
float(43.17)
["Code"]=>
NULL
["Description"]=>
NULL
["SubType"]=>
NULL
}
["ServiceOptionsCharges"]=>
object(Ups\Entity\Charges)#92 (5) {
["CurrencyCode"]=>
string(3) "USD"
["MonetaryValue"]=>
float(0)
["Code"]=>
NULL
["Description"]=>
NULL
["SubType"]=>
NULL
}
["TotalCharges"]=>
object(Ups\Entity\Charges)#93 (5) {
["CurrencyCode"]=>
string(3) "USD"
["MonetaryValue"]=>
float(43.17)
["Code"]=>
NULL
["Description"]=>
NULL
["SubType"]=>
NULL
}
}
}
["SurCharges"]=>
array(0) {
}
["TimeInTransit"]=>
NULL
["NegotiatedRates"]=>
NULL
}
}
}
But i am unable to access ['RatedShipment]['BillingWeight']['Weight'].
Where did i write a wrong code???
What do you think to use $arr = (array) $obj;?
Because it still looks like an object.
Or you could access $obj->RatedShipment->BillingWeight->Weight?
Related
I'd like to get a specific array data from an array I've get from this code :
$user = $request->instance()->query('user');
var_dump($user);exit;
And the result is :
array(1) { ["user"]=> object(App\Models\User)#332 (27) {
["fillable":protected]=> array(5) { [0]=> string(4) "name" [1]=>
string(8) "username" [2]=> string(5) "email" [3]=> string(8)
"password" [4]=> string(5) "token" } ["hidden":protected]=> array(2) {
[0]=> string(8) "password" [1]=> string(14) "remember_token" }
["casts":protected]=> array(1) { ["email_verified_at"]=> string(8)
"datetime" } ["connection":protected]=> string(5) "mysql"
["table":protected]=> string(5) "users" ["primaryKey":protected]=>
string(2) "id" ["keyType":protected]=> string(3) "int"
["incrementing"]=> bool(true) ["with":protected]=> array(0) { }
["withCount":protected]=> array(0) { } ["perPage":protected]=> int(15)
["exists"]=> bool(true) ["wasRecentlyCreated"]=> bool(false)
["attributes":protected]=> array(15) { ["id"]=> int(3) ["name"]=>
string(14) "Manchesteriyah" ["username"]=> string(14) "manchesteriyah"
["email"]=> string(24) "manchesteriyah#gmail.com" ["facebook"]=>
string(37) "https://web.facebook.com/xkionna" ["phone"]=> NULL
["email_verified_at"]=> NULL ["password"]=> string(60)
"$2y$10$IrqHE1JfyH0bJ0XD/Hjy.efLg95y/buTIir0PuXcOqDb1yCSS69Oe"
["image"]=> NULL ["description"]=> NULL ["role"]=> string(1) "1"
["token"]=> string(20) "ymsJxEtFnxdPBWYwlYFw" ["member_expiration"]=>
string(19) "2019-07-08 20:33:29" ["created_at"]=> string(19)
"2019-06-08 20:30:25" ["updated_at"]=> string(19) "2019-06-08
20:33:29" } ["original":protected]=> array(15) { ["id"]=> int(3)
["name"]=> string(14) "Manchesteriyah" ["username"]=> string(14)
"manchesteriyah" ["email"]=> string(24) "manchesteriyah#gmail.com"
["facebook"]=> string(37) "https://web.facebook.com/xkionna"
["phone"]=> NULL ["email_verified_at"]=> NULL ["password"]=>
string(60)
"$2y$10$IrqHE1JfyH0bJ0XD/Hjy.efLg95y/buTIir0PuXcOqDb1yCSS69Oe"
["image"]=> NULL ["description"]=> NULL ["role"]=> string(1) "1"
["token"]=> string(20) "ymsJxEtFnxdPBWYwlYFw" ["member_expiration"]=>
string(19) "2019-07-08 20:33:29" ["created_at"]=> string(19)
"2019-06-08 20:30:25" ["updated_at"]=> string(19) "2019-06-08
20:33:29" } ["changes":protected]=> array(0) { } ["dates":protected]=>
array(0) { } ["dateFormat":protected]=> NULL ["appends":protected]=>
array(0) { } ["dispatchesEvents":protected]=> array(0) { }
["observables":protected]=> array(0) { } ["relations":protected]=>
array(0) { } ["touches":protected]=> array(0) { } ["timestamps"]=>
bool(true) ["visible":protected]=> array(0) { }
["guarded":protected]=> array(1) { [0]=> string(1) "*" }
["rememberTokenName":protected]=> string(14) "remember_token" } }
What I'd like to get is the username value, I've tried some solution like this :
$user->username
but it give me error like this :
Trying to get property 'username' of non-object
How to fix this? Thanks for attention.
The $user variable seems to be holding an array containing 1 element, not the User itself. You must first retrieve the User object from the array and then access the username attribute.
$user = $request->instance()->query('user')['user'];
var_dump($user->username); exit;
I have an object I need to parse out and insert into SQL but I am having a hard time figuring out what I need to do as far as the order of fields in the syntax listed below.
Here is the object vardump:
object(EmailCheck\Object\ResponseObject)#25 (1) {
["response":protected]=> array(6) {
["status"]=> string(7) "success"
["total_results"]=> int(6)
["total_pages"]=> int(1)
["query"]=> array(8) {
["job_id"]=> int(2562625)
["valids"]=> int(1)
["invalids"]=> int(1)
["disposables"]=> int(1)
["catchalls"]=> int(1)
["unknowns"]=> int(1)
["page"]=> int(0)
["items_per_page"]=> int(10)
}
["results"]=> array(6) {
[0]=> array(2) {
["data"]=> array(4) {
["email"]=> string(20) "chris#example.com"
[0]=> string(1) "1"
["ID"]=> string(1) "1"
["EMAIL"]=> string(20) "chris#example.com"
}
["verification"]=> object(EmailCheck\Object\VerificationObject)#7 (1) {
["response":protected]=> array(7) {
["result"]=> string(5) "valid"
["flags"]=> array(3) {
[0]=> string(7) "has_dns"
[1]=> string(10) "has_dns_mx"
[2]=> string(16) "smtp_connectable"
}
["suggested_correction"]=> string(0) ""
["address_info"]=> object(EmailCheck\Object\ResponseObject)#9 (1) {
["response":protected]=> array(9) {
["original_email"]=> string(20) "chris#example.com"
["normalized_email"]=> string(20) "chris#example.com"
["addr"]=> string(6) "chris"
["alias"]=> string(0) "" ["host"]=> string(13) "example.com"
["fqdn"]=> string(13) "example.com"
["domain"]=> string(9) "example"
["subdomain"]=> string(0) ""
["tld"]=> string(3) "com"
}
}
["email"]=> string(20) "chris#example.com
["result_integer"]=> int(0)
["credits_info"]=> object(EmailCheck\Object\ResponseObject)#8 (1) {
["response":protected]=> array(0) {
}
}
}
}
}
I know the syntax is something like this but it is not returning anything:
echo $object->data->email;
I need to extract the following fields: result, normalized_email, email
This is what ended up working. I did not need to reference the "response" portion of the object.
$object->results[0]['data']['email']
i have put a returned API object response into an array but now i want to access the array data, i get undefined index, this is my code.
$paystack = new Yabacon\Paystack('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
$trx = $paystack->transactions(["perPage"=>1, "amount"=>10000, "status"=>"success"]); //RETURNED OBJECT
$array = (array) $trx; //CONVERTED FROM OBJECT TO ARRAY.
When I var_dump( (array) $trx ); i get
array(4) { ["status"]=> bool(true) ["message"]=> string(22) "Transactions retrieved" ["data"]=> array(1) { [0]=> object(stdClass)#21 (22) { ["id"]=> int(901742) ["domain"]=> string(4) "test" ["status"]=> string(7) "success" ["reference"]=> string(13) "58c0e61ca5cce" ["amount"]=> int(10000) ["message"]=> NULL ["gateway_response"]=> string(10) "Successful" ["paid_at"]=> string(24) "2017-03-08T22:48:33.000Z" ["created_at"]=> string(24) "2017-03-08T22:48:11.000Z" ["channel"]=> string(4) "card" ["currency"]=> string(3) "NGN" ["ip_address"]=> string(14) "xxx.xxx.xxx.xxx" ["metadata"]=> object(stdClass)#23 (2) { ["custom_fields"]=> array(1) { [0]=> object(stdClass)#22 (3) { ["display_name"]=> string(13) "Mobile Number" ["variable_name"]=> string(13) "mobile_number" ["value"]=> string(14) "+xxxxxxxxxxxxx" } } ["referrer"]=> string(27) "http://localhost/b/checkout" } ["log"]=> object(stdClass)#24 (9) { ["time_spent"]=> int(24) ["attempts"]=> int(1) ["authentication"]=> NULL ["errors"]=> int(0) ["success"]=> bool(true) ["mobile"]=> bool(false) ["input"]=> array(0) { } ["channel"]=> NULL ["history"]=> array(4) { [0]=> object(stdClass)#25 (3) { ["type"]=> string(5) "input" ["message"]=> string(55) "Filled these fields: card number, card expiry, card cvv" ["time"]=> int(20) } [1]=> object(stdClass)#26 (3) { ["type"]=> string(6) "action" ["message"]=> string(16) "Attempted to pay" ["time"]=> int(20) } [2]=> object(stdClass)#27 (3) { ["type"]=> string(7) "success" ["message"]=> string(17) "Successfully paid" ["time"]=> int(22) } [3]=> object(stdClass)#28 (3) { ["type"]=> string(5) "close" ["message"]=> string(11) "Page closed" ["time"]=> int(24) } } } ["fees"]=> int(150) ["fees_split"]=> NULL ["customer"]=> object(stdClass)#29 (8) { ["id"]=> int(102185) ["first_name"]=> string(0) "" ["last_name"]=> string(0) "" ["email"]=> string(23) "xxxxxxxxxx#gmail.com" ["customer_code"]=> string(19) "CUS_xxxxxxxxxxx" ["phone"]=> string(0) "" ["metadata"]=> NULL ["risk_action"]=> string(7) "default" } ["authorization"]=> object(stdClass)#30 (12) { ["authorization_code"]=> string(15) "AUTH_xxxxxxxxx" ["bin"]=> string(6) "412345" ["last4"]=> string(4) "1381" ["exp_month"]=> string(2) "01" ["exp_year"]=> string(4) "2020" ["channel"]=> string(4) "card" ["card_type"]=> string(4) "visa" ["bank"]=> string(9) "TEST BANK" ["country_code"]=> string(2) "NG" ["brand"]=> string(4) "visa" ["reusable"]=> bool(true) ["signature"]=> string(24) "SIG_xxxxxxxxxxxx" } ["plan"]=> object(stdClass)#31 (0) { } ["subaccount"]=> object(stdClass)#32 (0) { } ["paidAt"]=> string(24) "2017-03-08T22:48:33.000Z" ["createdAt"]=> string(24) "2017-03-08T22:48:11.000Z" } } ["meta"]=> object(stdClass)#33 (6) { ["total"]=> int(6) ["total_volume"]=> int(60000) ["skipped"]=> int(0) ["perPage"]=> string(1) "1" ["page"]=> int(1) ["pageCount"]=> int(6) } }
What I want to do is, I want to get it in this format
$stats = $array['data']['status'];
$order_id = $array['data']['id'];
$transaction_method = $array['data']['channel'];
$currency = $array['data']['currency'];
$reference = $array['data']['reference'];
$final_price = $array['data']['amount'];
$email_send = $array['data']['customer']['email'];
$day_paid = $array['data']['paid_at'];
$referring_page = $array['data']['metadata']['referrer'];
But when i ECHO any variable out e.g i do echo $stats OR echo $order_id i get
Notice: Undefined index: status in C:\xampp\htdocs\b\d\paystackorders.php on line 150
Notice: Undefined index: id in C:\xampp\htdocs\b\d\paystackorders.php on line 151.
How do i go around resolving this.
It needs to be $array['data'][0]['status']
and $array['data'][0]['id']
and so on...
This is because $array['data'] is an array of objects
The best way to go in my opinion is as follows:
$data = $array['data'][0];
And then access what you want :
$status = $data['status'];
$order_id = $data['id'];
I'm using cakephp 2.x and I would like to get certain element as field from my model. the problem is with my structure. If I use find all then I recieve this:
array(9) {
[0]=> ...
[1]=>
array(7) {
["Person"]=>
array(18) {
["id"]=>
int(2)
["imie"]=>
string(6) "STEFAN"
["nazwisko"]=>
string(8) "ŚMIAŁY"
["tel"]=>
string(13) "+55 648989748"
["mob"]=>
string(13) "+87 489747489"
["email"]=>
string(25) "HSDJKAHSDJK#HSDFJASHF.CIJ"
["tytul_naukowy"]=>
string(7) "TEZ NIE"
["data_od"]=>
string(10) "2017-02-16"
["data_do"]=>
NULL
["object_id"]=>
int(-1)
["object_type_id"]=>
int(2)
["duty_id"]=>
int(28)
["created"]=>
string(22) "2017-02-16 13:22:32+01"
["modified"]=>
string(22) "2017-02-16 13:22:32+01"
["deleted"]=>
int(0)
["additional_email"]=>
string(17) "UDIHAS#HFSDKFH.OK"
["description"]=>
string(4) "OPIS"
["displayName"]=>
string(15) "STEFAN ŚMIAŁY"
}
["Duty"]=>
array(3) {
["id"]=>
int(28)
["nazwa"]=>
string(20) "KOORDYNATOR RECEPCJI"
["atrybut"]=>
string(1) "W"
}
["ObjectType"]=>
array(3) {
["id"]=>
int(2)
["nazwa"]=>
string(4) "Obks"
["model"]=>
string(3) "Obk"
}
["Cro"]=>
array(12) {
["id"]=>
NULL
["created"]=>
NULL
["nazwa"]=>
NULL
["tel"]=>
NULL
["fax"]=>
NULL
["email"]=>
NULL
["www"]=>
NULL
["modified"]=>
NULL
["deleted"]=>
NULL
["cro_type_id"]=>
NULL
["displayName"]=>
NULL
["objectTypeIdWithId"]=>
NULL
}
["Attachment"]=>
array(0) {
}
["Specialization"]=>
array(0) {
}
["Obk"]=>
array(1) {
[0]=>
array(13) {
["id"]=>
int(2)
["nazwa"]=>
string(10) "OBK Z ID 2"
["tel"]=>
string(13) "+48 123456890"
["fax"]=>
string(13) "+48 123456789"
["email"]=>
string(15) "EMAIL#EMAIL.COM"
["www"]=>
string(11) "WWW.WWW.WWW"
["modified"]=>
string(22) "2017-03-20 15:11:31+01"
["created"]=>
string(22) "2014-05-12 21:50:17+02"
["deleted"]=>
int(0)
["local_order"]=>
int(3)
["displayName"]=>
string(10) "OBK Z ID 2"
["objectTypeIdWithId"]=>
string(3) "2_2"
["PeopleObk"]=>
array(3) {
["id"]=>
int(1)
["person_id"]=>
int(2)
["obk_id"]=>
int(2)
}
}
}
}
[2]=>
array(7) {
["Person"]=>
array(18) {
["id"]=>
int(3)
["imie"]=>
string(5) "KAMIL"
["nazwisko"]=>
string(10) "STEFAŃSKI"
["tel"]=>
string(13) "+23 123123123"
["mob"]=>
string(13) "+21 412312312"
["email"]=>
string(16) "ASDASD#SDFDSF.LS"
["tytul_naukowy"]=>
string(3) "NIE"
["data_od"]=>
string(10) "2017-02-22"
["data_do"]=>
NULL
["object_id"]=>
int(-1)
["object_type_id"]=>
int(2)
["duty_id"]=>
int(26)
["created"]=>
string(22) "2017-02-22 16:14:32+01"
["modified"]=>
string(22) "2017-02-22 16:14:32+01"
["deleted"]=>
int(0)
["additional_email"]=>
string(22) "ADAM.2313#WEBIMPULS.PL"
["description"]=>
string(4) "TEST"
["displayName"]=>
string(16) "KAMIL STEFAŃSKI"
}
["Duty"]=>
array(3) {
["id"]=>
int(26)
["nazwa"]=>
string(41) "KOORDYNATOR OŚRODKÓW BADAŃ KLINICZNYCH"
["atrybut"]=>
string(1) "W"
}
["ObjectType"]=>
array(3) {
["id"]=>
int(2)
["nazwa"]=>
string(4) "Obks"
["model"]=>
string(3) "Obk"
}
["Cro"]=>
array(12) {
["id"]=>
NULL
["created"]=>
NULL
["nazwa"]=>
NULL
["tel"]=>
NULL
["fax"]=>
NULL
["email"]=>
NULL
["www"]=>
NULL
["modified"]=>
NULL
["deleted"]=>
NULL
["cro_type_id"]=>
NULL
["displayName"]=>
NULL
["objectTypeIdWithId"]=>
NULL
}
["Attachment"]=>
array(0) {
}
["Specialization"]=>
array(0) {
}
["Obk"]=>
array(1) {
[0]=>
array(13) {
["id"]=>
int(3)
["nazwa"]=>
string(10) "OBK Z ID 3"
["tel"]=>
string(13) "+48 123456890"
["fax"]=>
string(13) "+48 123456789"
["email"]=>
string(15) "EMAIL#EMAIL.COM"
["www"]=>
string(11) "WWW.WWW.WWW"
["modified"]=>
string(22) "2017-03-20 10:45:24+01"
["created"]=>
string(22) "2014-05-16 09:09:33+02"
["deleted"]=>
int(0)
["local_order"]=>
int(1)
["displayName"]=>
string(10) "OBK Z ID 3"
["objectTypeIdWithId"]=>
string(3) "2_3"
["PeopleObk"]=>
array(3) {
["id"]=>
int(2)
["person_id"]=>
int(3)
["obk_id"]=>
int(3)
}
}
}
}
And I want just to retrieve Person.id, Person.displayName and Obk.0.id. The two first are no problem, but wheneve I try to get Obk.0.id I'm getting error: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM for Table Obk.
How can I get something like that? I want to set the value in codition later, but it block my work.
In CakePHP 2 you can specify the fields you want returned by a find() query using the fields option like:-
$this->Foo->find('all', [
'fields' => ['Foo.id', 'Foo.name']
]);
This also works with contained models that have a belongsTo or hasOne relationship:-
$this->Foo->find('all', [
'fields' => ['Foo.id', 'Foo.name', 'Bar.name'],
'contain' => ['Bar']
]);
However, if the contained model is a hasMany or HABTM relationship you need to specify the fields of that model on the contain:-
$this->Foo->find('all', [
'fields' => ['Foo.id', 'Foo.name'],
'contain' => [
'Bar' => ['fields' => 'Bar.name']
]
]);
This is because CakePHP will be performing multiple SQL queries, so the contain needs to have the parameters for the query being run for the relevant model.
I got follow array ($json_output):
array(3) {
["ProductsSummary"]=>
array(4) {
["Records"]=>
int(500)
["TotalRecords"]=>
int(5720)
["TotalPages"]=>
int(12)
["CurrentPage"]=>
int(2)
}
["Products"]=>
array(500) {
[0]=>
array(10) {
["ProductId"]=>
int(1323819499)
["ShopId"]=>
int(1856)
["ProductName"]=>
string(21) "Fossil Creole JF84757"
["Deeplink2"]=>
string(0) ""
["Brand"]=>
NULL
["Manufacturer"]=>
string(6) "Fossil"
["Distributor"]=>
NULL
["EAN"]=>
string(13) "4048803717479"
["Keywords"]=>
NULL
["Properties"]=>
array(3) {
[0]=>
array(2) {
["PropertyName"]=>
string(12) "DeliveryTime"
["PropertyValue"]=>
string(1) "5"
}
[1]=>
array(2) {
["PropertyName"]=>
string(17) "MerchantArtNumber"
["PropertyValue"]=>
string(8) "85145452"
}
[2]=>
array(2) {
["PropertyName"]=>
string(6) "gender"
["PropertyValue"]=>
string(5) "Damen"
}
}
}
[1]=>
array(10) {
["ProductId"]=>
int(1323819505)
["ShopId"]=>
int(1856)
["ProductName"]=>
string(16) "SANSIBAR Armband"
["Deeplink2"]=>
string(0) ""
["Brand"]=>
NULL
["Manufacturer"]=>
string(8) "Sansibar"
["Distributor"]=>
NULL
["EAN"]=>
NULL
["Keywords"]=>
NULL
["Properties"]=>
array(3) {
[0]=>
array(2) {
["PropertyName"]=>
string(12) "DeliveryTime"
["PropertyValue"]=>
string(1) "5"
}
[1]=>
array(2) {
["PropertyName"]=>
string(17) "MerchantArtNumber"
["PropertyValue"]=>
string(8) "85189719"
}
[2]=>
array(2) {
["PropertyName"]=>
string(6) "gender"
["PropertyValue"]=>
string(5) "Herren"
}
}
}
I need to unset all Products which contains 'Herren' in Properties, so I tried:
<?php
foreach($json_output["Products"] as & $bla)
$check = $bla["Properties"][0]["PropertyValue"] . $bla["Properties"][1]["PropertyValue"] . $bla["Properties"][2]["PropertyValue"];
if (preg_match('/Herren/',$check))
{
unset($bla);
}
?>
But it's not working.
array_filter iterates for you and returns a filtered set of elements.
The callback function returns true if the element is to remain, and false if it is to be removed. json_encode converts the whole array into a string, strpos looks for the string Herren anywhere in that string. Since you require no regular expression, there's no need to use preg_match which is slower than strpos.
$array['Products']=array_filter($array['Products'], 'removeHerren');
function removeHerren($array){
return strpos(json_encode($array), 'Herren')===false;
}