Do you mean like this
$result = 10;
foreach ( $posts as $post ) {
if ( $a = $b ) ) {
$result += 1;
} else {
$result -= 2;
}
}
echo 'Your result is ' . $result;
This is the best I can do with the provided information
Related Posts:
- C++ – how to find the length of an integer
- How can I make a PHP counter?
- Counting the posts of a loop (WP_Query)?
- Category and children post count
- Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type
- How to display 2 equal columns of li based on the count of items in wp_nav_menu divided by 2?
- Show weekly posts statistic in WordPress
- Increasing post view count automatically [duplicate]
- Count number of posts by author in a category
- How we count the user draft posts
- What is the best way to count and display the number of posts?
- Get count of terms with a post and another taxonomy term?
- Get Gravity Forms field values and count how many? [closed]
- Counting posts in custom post type by author
- Show ellipsis (…) only if the number of characters exceeds limit defined in substr
- Get total views of all posts by author
- Count post + add number =
- How to do simple addition to increase favorites count of my wordpress posts
- Count posts published in one particular day: the lighter way
- What is the best way to do this? [closed]
- Search Count WordPress Theme
- How to read out the excerpt length (for if-condition)
- $count_posts->draft & published
- CountPost WordPress Custom Taxonomy
- get the count of table rows
- How make animation increase of number
- Having problems getting the number of plays in a WordPress Playlist from an audio file
- How to show the amount of post that have on the site?
- Adding a posts count in archive pages
- Adding count also to parent categories
- Counting the number of elements with the values of x in a vector
- PHP 7.2 – Warning: count(): Parameter must be an array or an object that implements Countable
- How can I count the occurrences of a list item?
- How to count the occurrence of certain item in an ndarray?
- Pandas ‘count(distinct)’ equivalent
- How to sort a list of objects based on an attribute of the objects?
- Count the number of occurrences of a character in a string
- Calculate average in java
- Counting the occurrences / frequency of array elements
- Count how many files in directory PHP
- How to count the number of files in a directory using Python
- How to find length of digits in an integer?
- select count(*) from table of mysql in php
- How to get the count of each distinct value in a column?
- How to count instances of character in SQL Column
- How to mark every 3rd post
- Return only Count from a wp_query request?
- Count & Display Database Queries
- Count posts within a custom post type and specific taxonomy and terms?
- How to Display a List of Users Who Have Made at Least 1 Post?
- How to Display Network Post Count?
- Taxonomy count per Post type
- WP 3.5 and Galleries – how to count images?
- Count the number of images uploded on the website
- Total word count for posts by one author
- How to cache a shortcode functions output?
- show number of open comments on custom dashboard
- count posts from custom taxonomy terms by year
- Count posts or custom post types from last 24 hours (or from today)
- Comment Count for each Comment Author
- Display user’s total comment count outside The Loop
- Count posts that have specific taxonomy term attached
- Count post that have specific meta value
- Count posts in category including child categories
- How to count current user’s pages?
- Audio or playlist shortcode condition according to the amount of files on attachment page
- Count user posts by type and date
- How to update incorrect post count in taxonomy?
- Count singular post views automatically
- taxonomy list display custom post count
- Count number of post in Taxonomy?
- Display the number of published posts for each custom taxonomy term?
- Set font size automatically according to number of words in post
- Count custom post types with a specific meta value
- User Published Post Count
- Custom Post Type Category List & Post Count
- Limit tag word count
- Problem with get_posts, tax_query and counting the number of posts
- Network wide post count (WP Multisite)
- How to use global post counter in the loop?
- Add character count to custom metabox
- Insert html after certain amount of posts?
- Specific Loop For 2 Within Each
- Redirect based on user post count
- Taxonomy list. Order by a specific custom post type count
- Shortcode with product catgory counter
- Count posts for each year
- How to change post count in wordpress loop?
- Alternate custom content in the loop
- WordPress comment count to include attachment comments
- Get count of custom post type created by current user
- Number of items in a menu
- How to count get_users query?
- Post count per (day/month/year) since blog began
- How do I count how many top level categories there are?
- Show that current post is number X out of X
- How to get the number of child categories a specific parent category has?
- Check if an array of posts has posts from a specific category
- Count total number of post in foreach loop
- Count number of published posts by type