ok, i managed to get it to work with this
$amount1 = $invoice_amount;
$operator = $invoice_operator;
$amount2 = $invoice_multiplier;
$rvalue = mcalc ($amount1,$operator,$amount2);
function mcalc ($amount1,$operator,$amount2) {
if($operator=="+")
$result=$amount1+$amount2;
else if($operator=="-")
$result=$amount1-$amount2;
else if($operator=="x")
$result=$amount1*$amount2;
else if($operator=="/")
$result=$amount1/$amount2;
return $result;
}
echo $rvalue;
Related Posts:
- How can I fetch data from another website to my wordpress website with mysql database
- WP Function does not trigger on Webhook API Call
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- How to properly insert data into custom table via plugin
- Plugin update error message
- Keep one user logged for a year?
- pagination on data fetched using SQL query
- Check if variable is set in filter
- Cannot get wpdb data (Error in a simple fuction) [closed]
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- Checking the count within a foreach loop
- execute function after one completed
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- JQuery prepend a function
- Why can’t I call a (member) function from within a foreach?
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- wp_dequeue_script for a Plugin
- Need to replace Currency Shortforms
- wp_enqueue_scripts
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- How to get specific string/value from an array? php [closed]
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Plugin onclick button activate other plugin
- WordPress Stock Update Programatically
- Send email with list of active plugins upon activation/deactivation
- Using custom fields for image alt and title
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- How to translate wordpress error message
- Api external with wordpress
- All custom widgets are not showing in widget area at the same time
- speed up pagination for huge database
- Way to send multiple values for column to MySQL?
- Add the_post_thumbnail_url to a shortcode in function.php
- same user role or copy the user role to be same as the other role
- Different registration form for different roles
- Adding a Tag Parameter / Filter to My Shortcode
- More gentle way to hook WordPress custom url
- How to display results from a data table with an encrypted user id?
- How to add custom function to pluggable.php
- Check against server time to display SQL entries – Radio Station DJ Rotator Plugin
- Can you echo PHP code from a variable?
- add_action for publish_post doesn’t work
- WordPress Cache delete on plugin uninstall
- Checkbox show / hide output result
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Custom Logo Link WordPress
- How to convert Currency from USD to other IP Based currency in Php function
- Getting current user data with MySQL statement
- how to validate input field in wordpress generated with wpform plugin
- How to get the custom field value using SQL query
- add_rewrite_rule to load different page, without changing URL in browser
- implement custom roles in custom plugin
- WordPress Custom Hook with Class method
- How to get current cart values using WC_Shortcodes?
- Attempting to list all product categories and the price range of all products within them
- Allow a particular user to access a particular plugin?
- Cookie value changes back to previous value after changing
- Cant create table on plugin activation
- Creating an array from form inputs before it is posted to the options database
- How to get database connection details without longing to cpanel in WordPress?
- Post source link plugin – small modification
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Share my WordPress plugin for updating how?
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- adding dynamic/multiple slug values in ‘option_none_value’
- How to create algorithm for ordering posts in WordPress?
- Submitting form to PHP
- Adding discount functionality to the cart
- How to assign a specific service to a specific provider based on location
- Precheck fields when I add a new post
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- Get Shortcode output to database for static post_content
- working code, not working – Plugin Dev
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Moving a few select DB tables to a new WP instance
- Block plugin update possibilities (but not by hiding notifications)
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- post id or permalink auto-incrementing number and reset everyday
- Change custom rewrite rule when permalink is updated/changed
- Is admin section completely customizable in terms of styling?
- Return function results within shortcode
- Configuring default woo commerce login with modal popup
- How to make the first letter of a post title uppercase, in a plugin?
- Compare Ajax Data Results
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Soflyy WP All Import Custom File Download Issue
- register_activation_hook doesn’t fire at all
- Update (a function) post’s featured image as soon as $image_url changes
- get/show Last ID
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Nested DIV’s across functions in PHP, do not seem to work
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- Populate select option with JSON file
- Every time I use wp_get_current_user() my plugin breaks
- How to echo a plugin’s function into a template?
- How to replace native comment_count with Comments Evolved aggregate count
- Find all strings between an enclosing shortcode