S
S
Sergey2015-11-06 18:37:09
PHP
Sergey, 2015-11-06 18:37:09

An array within an array?

This is my array

$server_url_path = array(
"id" => array("qwester","client_number_id", "client_settings"),
"contact"); 

$url_path5 = "id";
$url_path6 = "client_number_id";

Can't find ID
if (in_array($url_path5, $server_url_path)) {
    echo "ID yes";
}

a Contact can find
if (in_array("contact", $server_url_path)) {
    echo "Con yes";
}

Inside the ID can also find
if (in_array($url_path6, $server_url_path["id"])) {
    echo "ID array yes";
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2015-11-06
@chelovekmuravei

maybe

if (isset ($server_url_path[$url_path5])){
echo "ID yes";
}

or
if (isset ($server_url_path['id'])){
echo "ID yes";
}

returns boolean upon checking for the presence of the given element

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question