Jump to content

[SOLVED] Count how many times $variable is found in $string


Dale_G

Recommended Posts

Hey everyone,

 

I need to know how to output, as an integer, the number of times some data is found in a string.

 

For example

 

$data = 'two';

 

$string = 'oneonethreetwofourseventwoeightninetwotwelve';

 

'two' is found three times in $string, I'd like to output '3', in integer form.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.