Essentially tags are received by the server in the following format when a form is used for editing an existing post (note I've simply converted $_POST to actual values to keep it simple)...
Code: Select all
$thread_tags = 'application/xhtml+xml, XML, XHTML, CSS';
$thread_tags_old = 'application/xhtml+xml, XML, XHTML, CSS, JavaScript';There are most likely numerous ways to approach this with the most confusing and least efficient most likely being my initial attempts. I've been thinking of converting these variables in to arrays (is there a nice PHP function to convert a nicely formatted variable or will we have to explode first?) and then using a loop (obviously) to compare the arrays. Then during the loop use something along the lines of the in_array function to determine if it's !in_array and then to queue it in to a MySQL query that I'll delete all of the removed tags from the database after the loop.
That is at least how I am thinking of approaching this task so I'm open to suggestions please!