Title: Math and Custom Fields
Last modified: August 19, 2016

---

# Math and Custom Fields

 *  [skitelluride531](https://wordpress.org/support/users/skitelluride531/)
 * (@skitelluride531)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/math-and-custom-fields/)
 * I am using the following code to create a variable that references a custom ID:
 * `<? $prodid = get_post_meta($post->ID, 'product-id', true) ?>`
 * Later on, I want to use the same custom field, but multiply it by 2. Is this 
   possible with PHP? I am thinking something ike this:
 * `<?php $prodid*2 ?>`
 * I know this is far from correct, however, I know it is something simple; I just
   don’t know enough PHP to figure it out!
 * Thanks so much!

Viewing 1 replies (of 1 total)

 *  Thread Starter [skitelluride531](https://wordpress.org/support/users/skitelluride531/)
 * (@skitelluride531)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/math-and-custom-fields/#post-1400549)
 * Solved!
 * <?
 * $second_number = 2;
    $sum_total = $second_number * $prodid;
 * print ($sum_total);
 * ?>

Viewing 1 replies (of 1 total)

The topic ‘Math and Custom Fields’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [Math](https://wordpress.org/support/topic-tag/math/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 1 reply
 * 1 participant
 * Last reply from: [skitelluride531](https://wordpress.org/support/users/skitelluride531/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/math-and-custom-fields/#post-1400549)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
