php - Comparing arrays, point me in the right direction please -
So what is trying to do, compare the orders in your database from the bank database and if they confirm the match status Mails
The transaction comes in an XML format
$ transaction-> User-number // This is the social security number of the person who transmits the transaction transactions - & gt; Amount // This is the transfer amount I need to compare the user-number in the user-number associated with the order in my database. I would like to create two arrays with those numbers Use array_intersect to find those data that are present in both databases and transactions xml. Now, I have to see the number of people who have done the transaction on their user-number, whether they have transferred the correct amount.
I will be able to finish it, but somehow I feel that using it is a simple solution in the form of an index in the form of a number and two arrays in the form of a user-number and value and Compare them.
Someone can help me here before writing some complex, slow and dirty code. / P>
thanks
Hopefully this will bring you the right path:
class commands {private $ user = null; Private $ emt = null; Public Function __construct ($ user, $ AMT) {$ this- & gt; User = $ user; $ This- & gt; AMT = $ AMT; } Public function getUser () {Return $ this- & gt; the user; } Public function equals ($ transactions) {if ($ -> this-> Users == $ Transaction-> Username & amp; amp; $ this-> AMT == $ Transaction-> Zodiac ) {truth; } return false; }} // An empty array to keep the entire order $ complete = array (); // Order a loop over the order ($ order as $ order) {// A new order object order order $ new order ($ order-> user, $ order- & gt; amount); // // // Loop on all Transactions Forex ($ Transaction as Transaction) // If the transaction is equal to our order, // add it to the complete order list ($ Order-> Equal ($ transactions)) {$ full [] = $ order; }}} This creates a small wrapper class for all your orders, then allows you to compare the order of any transaction as you described it above is.
I hope this helps.
Comments
Post a Comment