How do I replace part of a string in PHP

0 votes

I want to replace space in the first 10 characters of a string with '_'. 

  $text = substr($text, 0, 10);
  $text = strtolower($text);

Can someone help me with this?

May 28 in PHP by Kichu
• 19,040 points
4 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How do I strip all spaces out of a string in PHP?

If I have understood your question right, ...READ MORE

answered Feb 23 in PHP by Aditya
• 7,280 points
90 views
0 votes
0 answers

How can I remove part of a string in PHP?

How can I remove part of a ...READ MORE

Jun 19 in PHP by narikkadan
• 10,640 points
8 views
0 votes
1 answer

How PHP Replace last occurrence of a String in a String?

Hello @kartik, You can use this function: function str_lreplace($search, ...READ MORE

answered Aug 14, 2020 in PHP by Niroj
• 82,720 points
1,314 views
0 votes
1 answer

How do I get the HTML code of a web page in PHP?

Hello @kartik, If your PHP server allows url ...READ MORE

answered Oct 6, 2020 in PHP by Niroj
• 82,720 points
741 views
0 votes
1 answer

How do I get the last inserted ID of a MySQL table in PHP?

Hello @kartik, If you're using PDO, use PDO::lastInsertId. If you're ...READ MORE

answered Oct 22, 2020 in PHP by Niroj
• 82,720 points
447 views
0 votes
1 answer

How do I convert a string to a number in PHP?

You don't have to do this, since ...READ MORE

answered Feb 23 in PHP by Aditya
• 7,280 points
62 views
+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
524 views
0 votes
1 answer

How do I create folder under an Amazon S3 bucket through PHP API?

Of Course, it is possible to create ...READ MORE

answered Apr 24, 2018 in AWS by anonymous
9,124 views
0 votes
1 answer

Failure uploading Image on AmazonS3 with PHP SDK

Try this, I took it out from ...READ MORE

answered May 4, 2018 in AWS by Cloud gunner
• 4,660 points
2,109 views
0 votes
1 answer

Trying to call AWS API via PHP

Try using AWS SDK for PHP, Link ...READ MORE

answered Jun 6, 2018 in AWS by Cloud gunner
• 4,660 points
980 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP