{"id":8599,"date":"2021-08-23T23:49:51","date_gmt":"2021-08-23T20:49:51","guid":{"rendered":"https:\/\/elzero.org\/?p=8599"},"modified":"2022-08-07T07:03:24","modified_gmt":"2022-08-07T04:03:24","slug":"php-problems-solving-remove-character-from-string","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/php-problems-solving-remove-character-from-string\/","title":{"rendered":"Remove Character From A String"},"content":{"rendered":"<h3>\u0627\u0644\u062d\u0644<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-php\">\r\n\/\/ PHP Version 7.4.22 \r\n\r\n\/\/ Simple Solution\r\nfunction remove_char_from($word, $c) {\r\n  return str_replace(array(strtolower($c), strtoupper($c)), \"\", $word) . \"<br \/>\";\r\n}\r\n\r\n\/\/ Fundamental Solution\r\nfunction remove_char_from($word, $c) {\r\n\r\n  $charsList = str_split($word);\r\n\r\n  \/\/ echo '<pre>';\r\n  \/\/ print_r($charsList);\r\n  \/\/ echo '<\/pre>';\r\n\r\n  $newWord = \"\";\r\n  foreach ($charsList as $char) :\r\n    if ($char !== strtolower($c) && $char !== strtoupper($c)) {\r\n      $newWord .= $char;\r\n    }\r\n  endforeach;\r\n  return $newWord . \"<br \/>\";\r\n}\r\n\r\necho remove_char_from(\"ElddzeroD WebDD ddSchool\", \"d\"); \/\/ Elzero Web School\r\necho remove_char_from(\"ElxzeroX Web Sxchool\", \"x\"); \/\/ Elzero Web School\r\necho remove_char_from(\"Elzero@ Web@@ @@School\", \"@\"); \/\/ Elzero Web School\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>Remove Character From String With PHP<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1337],"tags":[],"class_list":["post-8599","post","type-post","status-publish","format-standard","hentry","category-problems-solving"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8599","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=8599"}],"version-history":[{"count":3,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8599\/revisions"}],"predecessor-version":[{"id":11690,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8599\/revisions\/11690"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}