Get Value of array with multiple values [closed] - php

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
i know that has to be a trivial one. Can please somebody tell me how only to get the value of skills? how can i access it?
Appreciate.

You have different options to choose from:
In plain PHP you can do:
$skills = array_map(function($entry) {
return $entry->skills;
}, $arr);
With Laravel helpers you can do:
Arr::pluck($arr, 'skills');
Your data looks like models so in that case, you might be able to do this as well:
YourModel::get()->pluck('skills'); //or
$yourCollection->pluck('skills');

Related

Is it possible to read sub URL as query string in PHP? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
This is my LOCAL URL:
http://localhost/wbdrupal/?url=http://werkbad-konfigurator.de/datahub/searchObjectByID?table=furniture&column=wbid&search=
when I echo this variable $_GET['url'];
then the output is http://werkbad-konfigurator.de/datahub/searchObjectByID?table=furniture
but I need output as http://werkbad-konfigurator.de/datahub/searchObjectByID?table=furniture&column=wbid&search=
I need full query string when I write this command: echo $_GET['url'];
Your URL is malformed and can't be parsed. The system has no way of knowing which key/value pairs belong to the actual URL or to the url value you're trying to submit.
You need to URL-encode your values so the system can know what the key/value pairs are:
http://localhost/wbdrupal/?url=http%3A%2F%2Fwerkbad-konfigurator.de%2Fdatahub%2FsearchObjectByID%3Ftable%3Dfurniture%26column%3Dwbid%26search%3D

2 dimensional array PHP [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I'm pretty new to php and I have problem with 2 dimentional array. When I try to do this:
$tab[0][0] = "dupa0";
$tab[0][1] = "dupa1";
echo("$tab[0][0]");
It doesn't work. How can I print a single element from this array?
you have to remove the quotes:
echo($tab[0][0]);

What is the "returnto" in this piece of code [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
header("Location: {$TBDEV['baseurl']}/login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]));
Is it a variable? PHP reserved word? something to do with HTML?
It's a $_GET parameter. When you submit the code, the page receiving it will be able to use $_GET['returnto'] to return you to the page you're currently on.
Take some time to learn about $_GET

Php help find where is syntax error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes===".$card['id']."") as $kat){
echo (kat['id_categories']);
}
table cols and values are all matched, something is wrong in this part of code
I tried adding $ before kat and using only one "=", sill doesnt work
NEW LINK
http://pastebin.com/RPK7vEaJ
this
where id_kartes===".$card['id']."
would be
where id_kartes=".$card['id']."
and missing $
echo $kat['id_categories'];
so full code :-
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes='".$card['id']."'") as $kat){
echo $kat['id_categories'];
}
best practice if you store your query result in a variable and loop over this variable.
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes=".$card['id']."") as $kat)

json php (Problems trying to exctract values) [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Hope someone can help me :)
I have a json to decode and i want to get some values in it but, i fail trying ...
The json to decode is this one :
$string = '{"TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a":{"fullId":"TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a","name":"La line Up","tag":"LILU","status":"RANKED","teamStatSummary":{"fullId":"TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a","teamStatDetails":[{"fullId":"TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a","teamStatType":"RANKED_TEAM_5x5","wins":4,"losses":2,"averageGamesPlayed":0},{"fullId":"TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a","teamStatType":"RANKED_TEAM_3x3","wins":0,"losses":0,"averageGamesPlayed":0}]},"roster":{"ownerId":21428398,"memberList":[{"playerId":23907761,"joinDate":1390159075000,"inviteDate":1390158849000,"status":"MEMBER"},{"playerId":21075924,"joinDate":1390158942000,"inviteDate":1390158852000,"status":"MEMBER"},{"playerId":21428398,"joinDate":1390158907000,"inviteDate":1390158856000,"status":"MEMBER"},{"playerId":29513977,"joinDate":1390158926000,"inviteDate":1390158911000,"status":"MEMBER"}]},"matchHistory":[{"kills":30,"deaths":51,"opposingTeamKills":51,"assists":50,"gameMode":"CLASSIC","opposingTeamName":"stavaclaroxd","win":false,"invalid":false,"mapId":1,"gameId":1284144814,"date":1390258314682},{"kills":9,"deaths":24,"opposingTeamKills":24,"assists":12,"gameMode":"CLASSIC","opposingTeamName":"Infinity gaming v2","win":false,"invalid":false,"mapId":1,"gameId":1282462494,"date":1390169929005},{"kills":32,"deaths":9,"opposingTeamKills":9,"assists":53,"gameMode":"CLASSIC","opposingTeamName":"Suburban Syndicate Squad","win":true,"invalid":false,"mapId":1,"gameId":1282421677,"date":1390167736333},{"kills":22,"deaths":3,"opposingTeamKills":3,"assists":32,"gameMode":"CLASSIC","opposingTeamName":"SKTlT5","win":true,"invalid":false,"mapId":1,"gameId":1282362755,"date":1390165366740},{"kills":24,"deaths":9,"opposingTeamKills":9,"assists":35,"gameMode":"CLASSIC","opposingTeamName":"нELLO HELLо","win":true,"invalid":false,"mapId":1,"gameId":1282304277,"date":1390163366886},{"kills":35,"deaths":11,"opposingTeamKills":11,"assists":58,"gameMode":"CLASSIC","opposingTeamName":"нELLO HELLо","win":true,"invalid":true,"mapId":1,"gameId":1282260799,"date":1390161678373}],"createDate":1390158828000,"modifyDate":1392723897000,"lastJoinDate":1390159075000,"secondLastJoinDate":1390158942000,"thirdLastJoinDate":1390158926000,"lastGameDate":1390422192000,"lastJoinedRankedTeamQueueDate":1390421982000}}';
I did something but with no result :
$json_a=json_decode($string,true);
$json_a[TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a][name]
That was a fail ... if someone can help me, I would be happy :)
Best regards,
CUETO Vincent
echo the value
echo $json_a['TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a']['name'];
This is not an array, but stdclass - {} not [].
Try:
$json_a->{'TEAM-d2dbb890-813d-11e3-9ae1-782bcb4ce61a'}->name

Categories