/    Sign up×
Community /Pin to ProfileBookmark

How To Breakup Words ?

Folks,

Can you show me a code sample how to do this …..

$string =
“Everyday a Daytona came in town. Then another day another Daytona was pulled in by VDayTwins”;

Show me which functions to use to separate the “Day” from everything. So now the $result_string would look like this:

“Every day a Day tona came in town. Then another day another Day tona was pulled in by
V Day Twins”;

No don’t want to be using str_replace().
I think you do it with explode() or implode() or whatever. And maybe using substring() and subposition() or whatever.
But do show me how you do it, if you know how to do it.

to post a comment
PHP

10 Comments(s)

Copy linkTweet thisAlerts:
@developer_webauthorMay 21.2021 — @NogDog,

What I am trying to achieve, I am sure you fiddled around with coding in your student periods.

Or, did I just come-up with something very unorthodox that nobody even tried this ?
Copy linkTweet thisAlerts:
@developer_webauthorMay 21.2021 — @DaveyErwin,

I learning programming from home and so don't know how the rest of the world plays around with coding (experimenting). I believe you have atleast experimented in the past what I am experimenting now. Or, haven't you ?

Well, I am sure other people have atleast tried this less complicated one:

https://www.webdeveloper.com/d/392961-how-to-join-words/2

Correct ?

Anyway, here let's stick to this not so less complicated one. Shall we ? 😄
Copy linkTweet thisAlerts:
@NogDogMay 21.2021 — This is how I'd do it. Your mission is to figure out why it works.
[code=php]
$string = "Everyday a Daytona came in town. Then another day another Daytona was pulled in by VDayTwins";
$output = preg_replace('/(day)([a-z])/i', '$1 $2', $string);
echo $output;
// Everyday a Day tona came in town. Then another day another Day tona was pulled in by VDay Twins
[/code]
Copy linkTweet thisAlerts:
@NogDogMay 21.2021 — Actually, I might change the regex a bit to make it a bit more flexible with other non-English letters:
[code=php]
$output = preg_replace('/(day)(w)/i', '$1 $2', $string);
[/code]
Copy linkTweet thisAlerts:
@developer_webauthorMay 23.2021 — @NogDog#1631958

Cheeers!

Try without regex. See if it becomes a challenge or not!
Copy linkTweet thisAlerts:
@developer_webauthorMay 29.2021 — @NogDog,

Care to try without the regex this time ?
Copy linkTweet thisAlerts:
@NogDogMay 29.2021 — > @developer_web#1632269 Care to try without the regex this time ?

Nope.
Copy linkTweet thisAlerts:
@akshay007May 29.2021 — Father’s Day – A Day Of Celebrating Fatherhood

<a href="https://shailybeautytips.com/fathers-day/">Father’s Day – A Day Of Celebrating Fatherhood</a>

"Father’s Day – A day of celebrating fatherhood and honouring fathers in society. Father’s day was celebrated first time in 1910, and now it is celebrated worldwide on the 3rd Sunday of June month to express love and respect to the fathers. This year in 2021, it will be celebrated on 20-Jun. The day shows the respect and value for the sacrifices and cares a father did to raise their children."
Copy linkTweet thisAlerts:
@pinky093Jun 11.2021 — ->Tell your BF or GF that you want to talk about something important.

->Start by mentioning something you like or value about the other person. ...

->Say what's not working (your reason for the break-up). ...

->Say you want to break up. ...

->Say you're sorry if this hurts. ...

->Say something kind or positive.
Copy linkTweet thisAlerts:
@developer_webauthorJul 18.2021 — @pinky093#1632819

->Tell your BF or GF that you want to talk about something important.

**Ok, Then, I tell you I want to talk something important.**

->Start by mentioning something you like or value about the other person. ...

**I'll start-off by saying I like about you is that you are new to my threads and got a high sense of humour.**

->Say what's not working (your reason for the break-up). ...

**Ok, what's not working is that, you did not contribute any code on this thread nor keep to the subject of php.**

->Say you want to break up. ...

**Why should I say I want to breakup with you ? We haven't even started yet. So, how shall we start ? Well, you can start contributing to all my threads that are open.**

->Say you're sorry if this hurts. ...

**Not sorry really. You haven't contributed to my threads yet where I failed to learn your line of coding.**

->Say something kind or positive.

Pinky is an Asian female name. Indian subcontinent. Either Hindu or Muslim.

Was that positive enough to DEFINE you ?

Check this out ...
<i>
</i>pinky_run()
{
echo 'I am a female';
}

pinky_mad()
{
echo 'I am asian';
}

echo pinky_run();
echo pinky_mad()
die('I am 27 years old!');


Well, that came at the top of my beginner level head. Now, you try.

Others may chime in too!
×

Success!

Help @developer_web spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...