How do I split a string

Keywords: string splitting, PHP, explode, substr
Description: This example demonstrates how to split a string in PHP using the explode function.
<?php // Define a string $string = "apple,banana,cherry"; // Split the string by the comma $fruits = explode(",", $string); // Print the resulting array print_r($fruits); ?> ` wraps everything up. - Keywords are placed inside a `
` with class `keywords`. - Description is placed inside a `
` with class `description`. - The example PHP code is placed inside a `` tag with the class `hljs language-php` for syntax highlighting.

Keywords: string splitting PHP explode substr