How to search string

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back