Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8182285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:48:50+00:00 2026-06-07T00:48:50+00:00

$myvalue = ‘Test some more’; $arr = explode(‘ ‘,trim($myvalue)); echo $arr[0]; // will print

  • 0
$myvalue = 'Test some more';
$arr = explode(' ',trim($myvalue));
echo $arr[0]; // will print Test

I use the code above to echo the first word from a sentence. Now I would like to also echo the first two characters from the second word. So that the above echo would result in:
Test so

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:48:52+00:00Added an answer on June 7, 2026 at 12:48 am
    $myvalue = 'Test some more';
    $pos = stripos($myvalue, ' ');
    echo substr($myvalue, 0, $pos + 3);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just curious, which code is more effective: if (myClass.getSomeValue() != myValue) myClass.setSomeValue(myValue); or simply
NSMutableURLRequest apparently changes case on header fields. For example, setting: [request addValue:myValue forHTTPHeaderField:@FOOBAR]; will
I am currently changing styling from code behind by doing: Div.Style[StyleAttribute] = MyValue; I
i'm trying to compare a value to an Enum in Struts: <s:if test=%{myValue ==
i send parameter usinge Response.Redirect() to anotherpage Response.Redirect(String.Format(~/mypage.aspx?value= + myvalue)) but myvalue has some
Can some one help me in this I had a variable var myValue =
I have this code: <g:form controller=IMI action=action1> <g:textField name=area value=${myValue} /> <br><br> <div id=address></div>
I want to style some text witch is wrapped in a html <code> tag.
I have code that works fine: var myValue = $(this).parents('tr:first').find('td:first').text(); is there anyway to
I have this code : /*string theXml = @<Response xmlns=http://myvalue.com><Result xmlns:a=http://schemas.datacontract.org/2004/07/My.Namespace xmlns:i=http://www.w3.org/2001/XMLSchema-instance><a:TheBool>true</a:TheBool><a:TheId>1</a:TheId></Result></Response>;*/ string theXml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.