Is to filter the minimum value, the maximum value .. however, when user_array_filter ($ aTxt, & #039; After_A_Num & #039;, $ iMaxStamp);, it is found that a value equal to $ iMaxStamp is missing, who can help me see what's going on? I can't see any problem... {code ...}
Is to filter the minimum value, the maximum value ..
However, when
User_array_filter ($ aTxt, 'After _ A_Num ', $ iMaxStamp );
When I found that a value equal to $ iMaxStamp was missing, who would help me see what's going on?
I can't see any problems either ..
Function user_array_filter (& $ array, $ callback) // The Following 3rd parameters can be used as the $ callback parameter; {$ args = func_get_args (); // save all function parameters as an array. if (count ($ args) <2) exit ('function user_array_filter () parameter is incorrect. there are at least two parameters. '); if (count ($ args) = 2) // if the two parameters are $ arr and $ callback {foreach ($ array as $ k => $ v) {$ result = $ callback ($ v); if (! $ Result) // if the function returns false; {unset ($ array [$ k]) ;}} else {$ limit = $ args [2]; // [0]-> process arrays, [1]-> function, [2]-> value foreach ($ array as $ k => $ v) {$ result = $ callback ($ v, $ limit); if (! $ Result) // if the function returns false; {unset ($ array [$ k]) ;}}$ array = array_values ($ array ); // redefines the key;} function Before_A_Num ($ num, $ limit) {if ($ num <$ limit) return true; return false;} function After_A_Num ($ num, $ limit) {if ($ num> $ limit) return true; return false ;}
Reply content:
Is to filter the minimum value, the maximum value ..
However, when
User_array_filter ($ aTxt, 'After _ A_Num ', $ iMaxStamp );
When I found that a value equal to $ iMaxStamp was missing, who would help me see what's going on?
I can't see any problems either ..
Function user_array_filter (& $ array, $ callback) // The Following 3rd parameters can be used as the $ callback parameter; {$ args = func_get_args (); // save all function parameters as an array. if (count ($ args) <2) exit ('function user_array_filter () parameter is incorrect. there are at least two parameters. '); if (count ($ args) = 2) // if the two parameters are $ arr and $ callback {foreach ($ array as $ k => $ v) {$ result = $ callback ($ v); if (! $ Result) // if the function returns false; {unset ($ array [$ k]) ;}} else {$ limit = $ args [2]; // [0]-> process arrays, [1]-> function, [2]-> value foreach ($ array as $ k => $ v) {$ result = $ callback ($ v, $ limit); if (! $ Result) // if the function returns false; {unset ($ array [$ k]) ;}}$ array = array_values ($ array ); // redefines the key;} function Before_A_Num ($ num, $ limit) {if ($ num <$ limit) return true; return false;} function After_A_Num ($ num, $ limit) {if ($ num> $ limit) return true; return false ;}
Clarify that your current problem (the following pseudocode) is:
$ A = [1, 3, 45, 6, 6, 7, 7]; user_array_filter ($ a, 'After _ A_Num ', 6); var_dump ($ ); // Current result [7, 7, 45]
But what you expect is[6,6,7,7,45]
Is that true?
If so, modifyAfter_A_Num
This function is greater than or equal.
I think it's not good to name your function like this.