PHP - Showing another array value when array value called
up vote
-4
down vote
favorite
I have 2 arrays
$dataX = array(
"a" => "a",
"b" => "b",
"c" => "c",
"d" => "d"
);
$dataY = array(
"1" => "1",
"2" => "2",
"3" => "3",
"4" => "4"
);
echo "<script>console.log(".json_encode($dataX['a']).");</script>";
Question, I want when I call dataX value 'a' it will show dataY '1' in console and when value dataX 'b' called it will show dataY '2'. Also, reverse when I call dataY '1' the console will show dataX 'a'.
php
New contributor
add a comment |
up vote
-4
down vote
favorite
I have 2 arrays
$dataX = array(
"a" => "a",
"b" => "b",
"c" => "c",
"d" => "d"
);
$dataY = array(
"1" => "1",
"2" => "2",
"3" => "3",
"4" => "4"
);
echo "<script>console.log(".json_encode($dataX['a']).");</script>";
Question, I want when I call dataX value 'a' it will show dataY '1' in console and when value dataX 'b' called it will show dataY '2'. Also, reverse when I call dataY '1' the console will show dataX 'a'.
php
New contributor
5
Question, I want.. I want or I need are no questions. Instead describe what is not working with your code
– B001ᛦ
Nov 8 at 10:28
array_combine?
– Jon Stirling
Nov 8 at 10:31
add a comment |
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
I have 2 arrays
$dataX = array(
"a" => "a",
"b" => "b",
"c" => "c",
"d" => "d"
);
$dataY = array(
"1" => "1",
"2" => "2",
"3" => "3",
"4" => "4"
);
echo "<script>console.log(".json_encode($dataX['a']).");</script>";
Question, I want when I call dataX value 'a' it will show dataY '1' in console and when value dataX 'b' called it will show dataY '2'. Also, reverse when I call dataY '1' the console will show dataX 'a'.
php
New contributor
I have 2 arrays
$dataX = array(
"a" => "a",
"b" => "b",
"c" => "c",
"d" => "d"
);
$dataY = array(
"1" => "1",
"2" => "2",
"3" => "3",
"4" => "4"
);
echo "<script>console.log(".json_encode($dataX['a']).");</script>";
Question, I want when I call dataX value 'a' it will show dataY '1' in console and when value dataX 'b' called it will show dataY '2'. Also, reverse when I call dataY '1' the console will show dataX 'a'.
php
php
New contributor
New contributor
New contributor
asked Nov 8 at 10:26
JatjatJat
1
1
New contributor
New contributor
5
Question, I want.. I want or I need are no questions. Instead describe what is not working with your code
– B001ᛦ
Nov 8 at 10:28
array_combine?
– Jon Stirling
Nov 8 at 10:31
add a comment |
5
Question, I want.. I want or I need are no questions. Instead describe what is not working with your code
– B001ᛦ
Nov 8 at 10:28
array_combine?
– Jon Stirling
Nov 8 at 10:31
5
5
Question, I want.. I want or I need are no questions. Instead describe what is not working with your code
– B001ᛦ
Nov 8 at 10:28
Question, I want.. I want or I need are no questions. Instead describe what is not working with your code
– B001ᛦ
Nov 8 at 10:28
array_combine?
– Jon Stirling
Nov 8 at 10:31
array_combine?
– Jon Stirling
Nov 8 at 10:31
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
JatjatJat is a new contributor. Be nice, and check out our Code of Conduct.
JatjatJat is a new contributor. Be nice, and check out our Code of Conduct.
JatjatJat is a new contributor. Be nice, and check out our Code of Conduct.
JatjatJat is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205807%2fphp-showing-another-array-value-when-array-value-called%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
5
Question, I want.. I want or I need are no questions. Instead describe what is not working with your code
– B001ᛦ
Nov 8 at 10:28
array_combine?
– Jon Stirling
Nov 8 at 10:31