How to calculate keyword frequency and draw the bar chart in PHPThis post shows you how to calculate the keyword frequency from text and draw the bar chart by using the JpGraph library. Calculate the keyword frequency Suppose we have a string like this: $str = "There are two cats on the table. One on the left sid...Jul 11, 2022 · 2 min readyanyy.hashnode.dev
How to count words in a string in PHPBy using the function str_word_count(), we can get information about words used in a string. Get the number of words found in a string To find out how many words in a string, you can do like this: $str = "aaa bbb ccc 123 ddd"; print_r(str_word_count...Jun 29, 2022 · 2 min readyanyy.hashnode.dev
Create an object from a string variable in PHPIn PHP, objects can be created from string variables. It provides a very convenient way for you to define rules in text and handle requests dynamically. In this post, we show you how to do it. Create an object from a string variable Supposed we have ...Jun 4, 2022 · 2 min readyanyy.hashnode.dev
Reverse an array in PHP by using recursionLet's go back to a computer science textbook topic. Show you how to reverse an array in PHP without using any native array functions such as array_xxx(). Recursion Recursion is a process in computer science to make a function call itself. The corresp...May 15, 2022 · 3 min readyanyy.hashnode.dev
PHP functions strcspn() and strspn()Function strcspn() The function strcspn() finds the length of initial segment not matching mask. In the code snippet below, we want to find the prefix length of a UK post code. CF34 9LH is the post code string and the disallowed character list is 012...May 4, 2022 · 2 min readyanyy.hashnode.dev