Hi
I'm bit stuck on how to put a period in array.
This is my example:
<pre>
<?php
$str = 'I like to eat Strawberry Cheesecake.';
$words = preg_split('@([\W]+)@', $str);
var_dump($words);
?>
</pre>
This is how it's var_dump()
:
array(7) {
[0]=>
string(1) "I"
[1]=>
string(4) "like"
[2]=>
string(2) "to"
[3]=>
string(3) "eat"
[4]=>
string(10) "Strawberry"
[5]=>
string(10) "Cheesecake"
[6]=>
string(0) ""
}
On my array[6]
there should be a period. How do I get that period?
Any Suggestions and explanation will help. I appreciate it. Thank!