NameSilo

How to search string

Spaceship Spaceship
Watch

snike

Established Member
Impact
3
I wanted to search a string. For example,

$string = "hello how are you today?";

How can I make a script so that it searchs that and finds how many times it finds the letter e? For example, in the example i gave the output should be 2.

Also, in a given set of numbers...

$hello = 3
$hello2 = 5
$hello3 = 2

How can a script find the varible with the highest value? and if it has a tie between two numbers it picks the first one?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
snike said:
I wanted to search a string. For example,

$string = "hello how are you today?";

How can I make a script so that it searchs that and finds how many times it finds the letter e? For example, in the example i gave the output should be 2.

Also, in a given set of numbers...

$hello = 3
$hello2 = 5
$hello3 = 2

How can a script find the varible with the highest value? and if it has a tie between two numbers it picks the first one?

Use this function:

http://us.php.net/manual/en/function.substr-count.php
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back