Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

munazzil's avatar

How to compare two json data using php one is xml other one is mysql?

I do have two json multidimensional array one is from database and other is from my public path it comes as xml, How do i compare both data are same or not?

one data coming from database,

	$shipment = Shipment::take('10')->get()->toJson();
 		$ship =  json_decode($shipment,TRUE);

I do have two json multidimensional array one is from database and other is from my public path it comes as xml, How do i compare both data are same or not?

one data coming from database,

 $shipment = Shipment::take('10')->get()->toJson();
 $ship =  json_decode($shipment,TRUE);

other data coming from local storage that is xml files,

  $files = File::get(storage_path('xml\Last_FILSDCSEA.xml'));      
  $xml = simplexml_load_string($files, "SimpleXMLElement", LIBXML_NOCDATA);
  $json = json_encode($xml);
  //dd($json);
  $data = json_decode($json,TRUE);

any changes have to made over this code please help?

0 likes
0 replies

Please or to participate in this conversation.