Sponsored Content
Top Forums Web Development Notes with Ravinder on Badging System Development Part II Post 303028310 by Neo on Friday 4th of January 2019 05:21:34 AM
Old 01-04-2019
Ravinder,

Please write a PHP function to parse the $color[] array and create the string(2) to append in the badge alert text.

Hint: You need to read a $serialized_badges JSON string (which we will get from the user table and convert it to a PHP array using json_decode() then perhaps a foreach() loop to compare against the current $color[] array.

Or, you can do all this in Javascript by storing the badge[] js array serialized in localstorage, which is how I would do it I think.... No reason to do this in PHP, so I think best to do in Javascript.
 

3 More Discussions You Might Find Interesting

1. What is on Your Mind?

New Badging System - Badges Prototype Beta 1 (Badges Only)

Today I mapped out the new badging system using FA icons, Beta 1 in no particular order except a 6 x 8 grid: https://www.unix.com/members/1-albums215-picture991.png The prototype HTML code for this layout: <style> .fa-badge-grid { font-size: 1.5em; } .row { ... (38 Replies)
Discussion started by: Neo
38 Replies

2. What is on Your Mind?

Status of Badging System - Beta 1

Dear All, Here is the current status of the badging system: The Beta 1 phase of the new badging system is close to completion. 42 prototype badges have been "allocated" 6 prototype badge slots are held in reserve The "alert you have new badges" prototype is running and is currently... (4 Replies)
Discussion started by: Neo
4 Replies

3. What is on Your Mind?

Badging System: UNIX.COM Bug Hunter Badge (New)

I have moved the bug badge out of reserve and into the main stream. Basically, I will assign a color level like the others, based on who has made a good actionable bug report for UNIX.COM. "Good" means screenshots, links, and even details from web dev tools our the HTML source code. So far,... (0 Replies)
Discussion started by: Neo
0 Replies
ARRAY_MERGE_RECURSIVE(3)						 1						  ARRAY_MERGE_RECURSIVE(3)

array_merge_recursive - Merge two or more arrays recursively

SYNOPSIS
array array_merge_recursive (array $array1, [array $...]) DESCRIPTION
array_merge_recursive(3) merges the elements of one or more arrays together so that the values of one are appended to the end of the previ- ous one. It returns the resulting array. If the input arrays have the same string keys, then the values for these keys are merged together into an array, and this is done recur- sively, so that if one of the values is an array itself, the function will merge it with a corresponding entry in another array too. If, however, the arrays have the same numeric key, the later value will not overwrite the original value, but will be appended. PARAMETERS
o $array1 - Initial array to merge. o $... - Variable list of arrays to recursively merge. RETURN VALUES
An array of values resulted from merging the arguments together. EXAMPLES
Example #1 array_merge_recursive(3) example <?php $ar1 = array("color" => array("favorite" => "red"), 5); $ar2 = array(10, "color" => array("favorite" => "green", "blue")); $result = array_merge_recursive($ar1, $ar2); print_r($result); ?> The above example will output: Array ( [color] => Array ( [favorite] => Array ( [0] => red [1] => green ) [0] => blue ) [0] => 5 [1] => 10 ) SEE ALSO
array_merge(3), array_replace_recursive(3). PHP Documentation Group ARRAY_MERGE_RECURSIVE(3)
All times are GMT -4. The time now is 12:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy