Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php function getdr($s, $v, $d) { global $u; $i = 0; while ($i < count($v)) { if (isset($v[$i])) { $s = str_replace("{" . $v[$i] . "}", $d[$i], $s); } $i++; } $no_floor = is_numeric($s) == 1 ? true : false; return $no_floor ? $s : floor(eval("return (" . $s . ");")); } $u = (object)[ 'info' => ['level' => 10], 'stats' => ['s5' => 16, 'mpAll' => 0] ]; $pl = [ 'info' => 'Следующий удар или заклятие нанесет вам не более 1 повреждения, противник получает #3*{lvl1}# ед. урона' ]; preg_match( "/#(.*?)#/ism", ['lvl1', 'ts5', 'mpAll'], $m ); print_r($m); $res = preg_replace( "/#(.*?)#/is", ['lvl1', 'ts5', 'mpAll'], [$u->info["level"], $u->stats['s5'], $u->stats["mpAll"]], $pl["info"] ); var_dump($res);
Copy Clear