All Projects → langleyfoxall → math_eval

langleyfoxall / math_eval

Licence: LGPL-3.0 license
✖️➕➖➗ `math_eval` safely evaluates mathematical expressions

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to math eval

decimal-eval
A tiny, safe, fast JavaScript library for decimal arithmetic expressions.
Stars: ✭ 18 (-45.45%)
Mutual labels:  math, eval, math-eval
Linear-Algebra-and-Its-Applications-notes
《线性代数及其应用》笔记
Stars: ✭ 196 (+493.94%)
Mutual labels:  math, mathematics
maths-for-deep-learning-ai
A open source book covering the foundational maths of deep learning and machine learning using TensorFlow
Stars: ✭ 35 (+6.06%)
Mutual labels:  math, mathematics
codex
A repository of mathematical knowledge written in the MathLingua language.
Stars: ✭ 17 (-48.48%)
Mutual labels:  math, mathematics
noteworthy
Markdown editor with bidirectional links and excellent math support, powered by ProseMirror. (In Development!)
Stars: ✭ 178 (+439.39%)
Mutual labels:  math, mathematics
Fourier-and-Images
Fourier and Images
Stars: ✭ 81 (+145.45%)
Mutual labels:  math, mathematics
Tau.jl
A Julia module providing the definition of the circle constant Tau (2π)
Stars: ✭ 33 (+0%)
Mutual labels:  math, mathematics
Julia Set Playground
A Swift playground that generates beautiful Julia set fractal images.
Stars: ✭ 236 (+615.15%)
Mutual labels:  math, mathematics
Mathos-Project
The Mathos Core Library
Stars: ✭ 22 (-33.33%)
Mutual labels:  math, mathematics
pyrgg
🔧 Python Random Graph Generator
Stars: ✭ 158 (+378.79%)
Mutual labels:  math, mathematics
graphest
A faithful graphing calculator
Stars: ✭ 42 (+27.27%)
Mutual labels:  math, mathematics
speedy-math
An application which allows user (small kids) to practice basic Mathematics operations
Stars: ✭ 28 (-15.15%)
Mutual labels:  math, mathematics
mml-book-chinese
mml-book-chinese《Mathematics For Machine Learning》机器学习中的数学 中文版
Stars: ✭ 113 (+242.42%)
Mutual labels:  math, mathematics
mish
A no-std libm implementation in Rust
Stars: ✭ 14 (-57.58%)
Mutual labels:  math, mathematics
MathImprove
Modify and Improve math expressions.
Stars: ✭ 13 (-60.61%)
Mutual labels:  math, mathematics
Oscar.jl
A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
Stars: ✭ 182 (+451.52%)
Mutual labels:  math, mathematics
Tutorials
AI-related tutorials. Access any of them for free → https://towardsai.net/editorial
Stars: ✭ 204 (+518.18%)
Mutual labels:  math, mathematics
Stdlib
✨ Standard library for JavaScript and Node.js. ✨
Stars: ✭ 2,749 (+8230.3%)
Mutual labels:  math, mathematics
Mathematics for Machine Learning
Learn mathematics behind machine learning and explore different mathematics in machine learning.
Stars: ✭ 28 (-15.15%)
Mutual labels:  math, mathematics
tukey
Mini stats toolkit for Clojure/Script
Stars: ✭ 17 (-48.48%)
Mutual labels:  math, mathematics

✖️ Math Eval Helper Function

Build Status Coverage Status StyleCI Packagist

This PHP package provides a math_eval helper function, that allows safe evaluation of mathematical expressions, without the use of the potentially dangerous eval function.

Installation

The math_eval package can be easily installed using Composer. Just run the following command from the root of your project.

composer require "langleyfoxall/math_eval"

If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started.

Usage

To evaluate a basic mathematical expression, just pass its string representation to the math_eval function.

Here are some basic usage examples:

$two = math_eval('1 + 1');
$three = math_eval('5 - 2');
$ten = math_eval('2 * 5');
$four = math_eval('8 / 2');

It is also possible to pass expression variables. See the examples below.

$ten = math_eval('a + b', ['a' => 7, 'b' => 3]);
$fifteen = math_eval('x * y', ['x' => 3, 'y' => 5]);

Credit

This package makes use of the mossadal/math-parser package.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].