Array, $variable, $counter

Created on: 21.07.2024 14:15
Last update: 23.07.2024 12:17

english 314

Array, $variable, $counter

If you already have the values ​​from an array (these are separated by commas and output as a string) and you want to use them as a counter.

$variable = (your string from an array);

echo $variable; => is output as an example with the values ​​(one, two, three, four, five).

Now you need a counter that shows the number of values ​​as a counter, i.e. (5).

       $count_string = explode(",",$variable);
       foreach($count_string as $string) $return_string[$string]++;
       foreach($return_string as $return_single => $single_string) 

       $counter += ($single_string); // Adding together the individual values.
       echo $counter; // Here the result is shown as 5.

Average overall rating
 off 3 Reviews
Awarded 3 x 5  Stars
Why your email address?
If necessary, I will contact you to help you with the implementation.
Your email address will not be made public.
Is this post helpful to you?
Please enter the verification code!
Please enter the verification code!
Information(1)
General information
 Free advertising
Post counter
Current information status:
Categories: 9
Posts: 104
Support pages: 57
Downloads for members: 104
Download counter: 646
Reviews total79
Companies: 34
Support: 38
Information: 7