{"id":1,"date":"2024-03-15T18:30:29","date_gmt":"2024-03-15T18:30:29","guid":{"rendered":"https:\/\/dev.gragot.com\/?p=1"},"modified":"2024-03-15T18:34:43","modified_gmt":"2024-03-15T18:34:43","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/dev.gragot.com\/?p=1","title":{"rendered":"Hello world!"},"content":{"rendered":"\n<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\r\n$a = '\u00e1\u010d'; \/\/ 2 accented chars\r\n\r\n$b = mb_str_pad($a, $lenA + 10, ' ');\r\n$lenB = \\mb_strlen($b);\r\necho $lenB . PHP_EOL;\r\n\r\nfunction mb_str_pad(string $str, int $len, string $pad, int $align = \\STR_PAD_RIGHT): string\r\n{\r\n   $strLen = \\mb_strlen($str);\r\n   if ($strLen >= $len) {\r\n      return $str;\r\n   }\r\n\r\n   $diff = $len - $strLen;\r\n   $padding = \\mb_substr(\\str_repeat($pad, $diff), 0, $diff);\r\n\r\n   switch ($align) {\r\n      case \\STR_PAD_BOTH:\r\n         $diffHalf = (int)($diff\/2 + 0.5);\r\n         $padding = \\str_repeat($pad, $diffHalf);\r\n         $result = \"{$padding}{$str}{$padding}\";\r\n         break;\r\n      case \\STR_PAD_LEFT:\r\n         $result = \"{$padding}{$str}\";\r\n         $result = \"{$str}{$padding}\";\r\n         break;\r\n      case \\STR_PAD_RIGHT:\r\n      default:\r\n         $result = \"{$str}{$padding}\";\r\n         break;\r\n   }\r\n\r\n   return \\mb_substr($result, 0, $len);\r\n}\r\n?><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dev.gragot.com\/index.php?rest_route=\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.gragot.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.gragot.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.gragot.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.gragot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1"}],"version-history":[{"count":2,"href":"https:\/\/dev.gragot.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":8,"href":"https:\/\/dev.gragot.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions\/8"}],"wp:attachment":[{"href":"https:\/\/dev.gragot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.gragot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.gragot.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}