How to get common value from two json file (array) in php ?

in WORLD OF XPILAR3 years ago

This is one way to check the difference between two array or json. Make sure the pattern in json / array is similar to one another or else you will see error.

    $json1 = file_get_contents('https://yourendpointurlhere.com/json1');
    //This is response returned from an endpoint.

carbon.png

    $json2 = file_get_contents('https://yourendpointurlhere.com/json2');
    //This is response returned from an endpoint.

carbon (1).png

Here we want to get common name from two file. As array counting starts from 0, the name indexing is 1.

Here is the sample code for the implementation.

carbon (2).png

You will get array of names in result. Hope that helps

Sort:  
Loading...

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 58665.81
ETH 3153.57
USDT 1.00
SBD 2.44