{"id":21433688,"url":"https://github.com/thomassquall/phpstringutils","last_synced_at":"2025-03-16T22:44:02.894Z","repository":{"id":57068980,"uuid":"163286927","full_name":"ThomasSquall/PHPStringUtils","owner":"ThomasSquall","description":"Collection of string utils for php","archived":false,"fork":false,"pushed_at":"2019-10-19T17:02:15.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T00:50:33.890Z","etag":null,"topics":["php","string-manipulation","strings","utils","utils-library"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThomasSquall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-27T11:32:28.000Z","updated_at":"2021-04-18T13:45:03.000Z","dependencies_parsed_at":"2022-08-24T14:54:14.250Z","dependency_job_id":null,"html_url":"https://github.com/ThomasSquall/PHPStringUtils","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasSquall%2FPHPStringUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasSquall%2FPHPStringUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasSquall%2FPHPStringUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThomasSquall%2FPHPStringUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThomasSquall","download_url":"https://codeload.github.com/ThomasSquall/PHPStringUtils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945525,"owners_count":20372894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","string-manipulation","strings","utils","utils-library"],"created_at":"2024-11-22T23:29:24.115Z","updated_at":"2025-03-16T22:44:02.867Z","avatar_url":"https://github.com/ThomasSquall.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# String Utils for php\n\n## List of available functions\n\n1) [string_starts_with](#string_starts_with)\n2) [string_ends_with](#string_ends_with)\n3) [string_between](#string_between)\n4) [strings_between](#strings_between)\n5) [string_contains](#string_contains)\n\n### string_starts_with\n\n#### Description\n\nReturns true if the $haystack string starts with the $needle string.\n\n#### Definition\n\nstring_starts_with($haystack, $needle)\n\nWhere:\n1) $haystack is the string to look into\n2) $needle is the string to check if the $haystack starts with\n\n#### Usage\n\n``` php\n$string = \"Hello World\";\n\necho \"Starts with Hello? \" . string_starts_with($string, \"Hello\");\necho PHP_EOL;\necho \"Starts with World? \" . string_starts_with($string, \"World\");\n```\n\nThis will print:\n\n``` sh\nStarts with Hello? true\nStarts with World? false\n```\n\n### string_ends_with\n\n#### Description\n\nReturns true if the $haystack string ends with the $needle string.\n\n#### Definition\n\nstring_ends_with($haystack, $needle)\n\nWhere:\n1) $haystack is the string to look into\n2) $needle is the string to check if the $haystack starts with\n\n#### Usage\n\n``` php\n$string = \"Hello World\";\n\necho \"Ends with Hello? \" . string_ends_with($string, \"Hello\");\necho PHP_EOL;\necho \"Ends with World? \" . string_ends_with($string, \"World\");\n```\n\nThis will print:\n\n``` sh\nEnds with Hello? false\nEnds with World? true\n```\n\n### string_between\n\n#### Description\n\nReturns the first occurrence of the string between the $start and $end string from $string. False if nothing is found.\n\n#### Definition\n\nstring_between($string, $start, $end, $empty_string = false)\n\nWhere:\n1) $string is the string to look into\n2) $start is the left string to search\n3) $end is the right string to search\n4) $empty_string determines whether return empty strings or not\n\n#### Usage\n\n``` php\n$string_1 = \"|Hello|World|\";\n$string_2 = \"||\";\n\necho \"String 1: \" . string_between($string_1, \"|\", \"|\");\necho PHP_EOL;\necho \"String 2 with $empty_string false: \" . string_between($string_2, \"|\", \"|\");\necho PHP_EOL;\necho \"String 2 with $empty_string true: \" . string_between($string_2, \"|\", \"|\", true);\n```\n\nThis will print:\n\n``` sh\nString 1: Hello\nString 2: false\nString 2: \n```\n\n### strings_between\n\n#### Description\n\nReturns the strings between the $start and $end string from $string. Empty array if nothing is found.\n\n#### Definition\n\nstrings_between($string, $start, $end, $empty_strings = false)\n\nWhere:\n1) $string is the string to look into\n2) $start is the left string to search\n3) $end is the right string to search\n4) $empty_strings determines whether return empty strings or not\n\n#### Usage\n\n``` php\n$string = \"|Hello|World||\";\n\necho \"With $empty_strings false:\" . PHP_EOL;\nprint_r(strings_between($string, \"|\", \"|\"));\necho PHP_EOL;\necho \"With $empty_strings true:\" . PHP_EOL;\nprint_r(strings_between($string, \"|\", \"|\", true));\n```\n\nThis will print:\n\n``` sh\nWith $empty_strings false:\nArray ( [0] =\u003e Hello [1] =\u003e World )\n\nWith $empty_strings true:\nArray ( [0] =\u003e Hello [1] =\u003e World [2] =\u003e )\n```\n\n### string_contains\n\n#### Description\n\nTrue or false whether the string $needle is contained in the string $haystack or not.\n\n#### Definition\n\nstring_contains($haystack, $needle)\n\nWhere:\n1) $haystack is the string to look into\n2) $needle is the string to check if the $haystack contains\n\n#### Usage\n\n``` php\n$string = \"Hello\";\n\necho \"Contains Hello? \" . string_contains($string, \"Hello\");\necho PHP_EOL;\necho \"Contains World? \" . string_contains($string, \"World\");\n```\n\nThis will print:\n\n``` sh\nContains Hello? true\nContains World? false\n```\n\n## More utilities coming","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomassquall%2Fphpstringutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomassquall%2Fphpstringutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomassquall%2Fphpstringutils/lists"}