PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
-- Hint: use Ctrl+Enter for SQL autocomplete DROP TABLE IF EXISTS `product`; CREATE TABLE IF NOT EXISTS `product` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID of the Product', `name_en` varchar(255) NOT NULL COMMENT 'Name of the Product in Englisch', `name_de` varchar(255) DEFAULT NULL COMMENT 'Name of the Product in German', `name_fr` varchar(255) DEFAULT NULL COMMENT 'Name of the Product in France', `group` int(10) UNSIGNED DEFAULT 1 COMMENT 'ID of the Product Group', `unit` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Id of the Unit', `default_consumption` float UNSIGNED NOT NULL DEFAULT 0.5 COMMENT 'Value for Default Consumption', `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp of creation Time', `changed_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Timestamp of changed', `deleted_at` timestamp NULL DEFAULT NULL COMMENT 'Timestamp of deleted', PRIMARY KEY (`id`), KEY `product_name_en_idx` (`name_en`), KEY `product_name_de_idx` (`name_de`), KEY `product_name_fr_idx` (`name_fr`), KEY `product_group_idx` (`group`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Dumping data for table `product` -- INSERT INTO `product` (`id`, `name_en`, `name_de`, `name_fr`, `group`, `unit`, `default_consumption`, `created_at`, `changed_at`, `deleted_at`) VALUES (1, 'Test', NULL, NULL, 1, 1, 0.5, '2021-03-23 11:37:17', NULL, NULL); DROP TABLE IF EXISTS `stock`; CREATE TABLE IF NOT EXISTS `stock` ( `product` int(10) UNSIGNED NOT NULL COMMENT 'ID of the Product', `user` int(10) UNSIGNED NOT NULL COMMENT 'ID of the User', `stock` float UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Stock Value', `individual_consumption` float UNSIGNED DEFAULT NULL COMMENT 'Individual Consumption Value', `ki_value` float UNSIGNED DEFAULT 0 COMMENT 'KI Up Down Value', `last_buy` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Timestmap of last Buy', KEY `stock_product_idx` (`product`), KEY `stock_user_idx` (`user`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Copy Clear
Copy Format Clear
<?php $arr = []; for ($c = 0; $c < 100; $c++) { $start = microtime(true); $str = "строка текста некая с мусором"; for ($i = 0; $i < 500; $i++) { //$str_v2 = str_replace(" с мусором", "", $str); $str_v2 = preg_replace("~ с мусором~isu", "", $str); $str_v2 = $str; } $end = (microtime(true) - $start); $end = round($end, 4); $arr[] = $end; } var_dump(array_sum($arr)/100);
Show:  
Copy Clear