{"id":11149,"date":"2022-06-23T04:55:31","date_gmt":"2022-06-23T01:55:31","guid":{"rendered":"https:\/\/elzero.org\/?p=11149"},"modified":"2022-08-07T07:55:36","modified_gmt":"2022-08-07T04:55:36","slug":"php-implement-string-left-trim-function","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/php-implement-string-left-trim-function\/","title":{"rendered":"String Left Trim Function"},"content":{"rendered":"<h3>\u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062f\u0631\u0633<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-php\">\r\n<?php \r\n\r\nfunction elzero_string_left_trim(string $str, mixed $val = \" \") : string {\r\n  $result = \"\";\r\n  $stop = False;\r\n  for ($i = 0; $i < strlen($str); $i++) :\r\n    if ($str[$i] === $val and $stop === False) {\r\n      continue;\r\n    } else {\r\n      $stop = True;\r\n    }\r\n    $result .= $str[$i];\r\n  endfor;\r\n  return $result;\r\n}\r\n\r\necho elzero_string_left_trim(\"    Elzero\") . \"<br>\";\r\necho strlen(elzero_string_left_trim(\"    Elzero\")) . \"<br>\";\r\n\r\necho elzero_string_left_trim(\"@@@@Elz@@ero\", \"@\") . \"<br>\";\r\necho strlen(elzero_string_left_trim(\"@@@@Elz@@ero\", \"@\")) . \"<br>\";\r\n\r\necho elzero_string_left_trim(\"    Elze  ro\") . \"<br>\";\r\necho strlen(elzero_string_left_trim(\"    Elze  ro\")) . \"<br>\";\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>\u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062f\u0631\u0633<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1156],"tags":[],"class_list":["post-11149","post","type-post","status-publish","format-standard","hentry","category-functions-implement"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/11149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=11149"}],"version-history":[{"count":4,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/11149\/revisions"}],"predecessor-version":[{"id":11699,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/11149\/revisions\/11699"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=11149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=11149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=11149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}