WSC 5.3, 5.4 & 5.5 [Entwickler] Shunting-yard
- 8 Downloads
[Entwickler] Shunting-yard

- Rezensionen
-
0 Kundenrezensionen - Produktinformation
Shunting-yard-Algorithmus-Implementation für die WoltLab Suite.
- Support Forum
- WSC 5.5 / WSF 5.5
- Preis
- Kostenlos
- Downloads
- 8
Produktbeschreibung
Diese Erweiterung für die WoltLab Suite 5.2+ erweitert selbige um eine Implementation des Shunting-yard-Algorithmus, mit dessen Hilfe sich mathematische Operationen (z.B. aus einer Option heraus) ohne Nutzung potenziell gefährlicher PHP-Funktionen ausführen lassen.
Nutzungsbeispiele:
PHP
<?php
require_once(WCF_DIR . 'lib/system/api/php-shunting-yard/autoload.php');
$equation = '3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3';
$result = \RR\Shunt\Parser::parse($equation);
echo $result; // 3.0001220703125
PHP
<?php
require_once(WCF_DIR . 'lib/system/api/php-shunting-yard/autoload.php');
$string = 'max(%x * 0.1 + 0.35, 2000)';
$string = str_replace('%x', 3434.133, $string);
$ctx = new \RR\Shunt\Context();
$allowedFunctions = ['ceil', 'exp', 'floor', 'fmod', 'max', 'min', 'pow']; // erlaubte PHP-Funktionen
foreach ($allowedFunctions as $fn) {
if (str_contains($string, $fn . '(')) {
$ctx->def($fn);
}
}
$result = \RR\Shunt\Parser::parse($string, $ctx);
echo $result; // 2000
Alles anzeigen
-
[Entwickler] Shunting-yard 1.1.0
- 8,62 kB
Update für PHP 7.0+ -
[Entwickler] Shunting-yard 1.0.2
- 8,71 kB
Durchschnittliche Kundenbewertung
0 von 5 (0 Kundenrezensionen)
-
5 Sterne (0)
-
4 Sterne (0)
-
3 Sterne (0)
-
2 Sterne (0)
-
1 Stern (0)
Aktuell sind keine Kundenrezensionen vorhanden. Seien Sie der Erste, der eine Rezension erstellt!