473,466 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

separate the string

254 Contributor
hello

I am new to php and i want to separate the string "hello, everyone how are you?"

and want to echo (print) all the characters separetly in php. how can i do that.
Dec 5 '07 #1
3 1244
chinmay4u
5 New Member
Its very easy u should try urself to solve these kinds of methods any way here is the code ,


<?php
$someWords = "hello, everyone how are you?";
$wordseparate = explode(" ", $someWords);
for($i = 0; $i < count($wordseparate); $i++){
echo "$wordseparate[$i] <br />";
}
?>

good luck , keep experimenting.
Dec 5 '07 #2
mukeshrasm
254 Contributor
Its very easy u should try urself to solve these kinds of methods any way here is the code ,


<?php
$someWords = "hello, everyone how are you?";
$wordseparate = explode(" ", $someWords);
for($i = 0; $i < count($wordseparate); $i++){
echo "$wordseparate[$i] <br />";
}
?>

good luck , keep experimenting.
it prints
Hello,
everyone
how
are
you?

but i want all the character must nbe separated like
H
e
l
l
o

and so on.

so please if you can help me!
Dec 5 '07 #3
brettl
41 New Member
You can use str_split and create an array of all the characters.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $someWords = "hello, everyone how are you?";
  3. $wordseparate = str_split($someWords);
  4. for($i = 0; $i < count($wordseparate); $i++){
  5. echo "$wordseparate[$i] <br />";
  6. }
  7. ?>
  8.  
I hope this helps.
Dec 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Jaime Wyant | last post by:
I know I've seen this somewhere, but can't seem to google it. Is there a way to use an alternate statement separator, other than the default ';'? jw
2
by: Stian | last post by:
Hi! I have made a form with two SELECT LIST-boxes where the first is dynmically filled when you enter the page, and then one can select multiple options from the list and move across to the...
3
by: Roberto Becerril | last post by:
Hi forum, i'm a little new in javascript and maybe you can help me. I have an html form and an icon, if i click on the icon, a new pop-up window is open and shows a list of numbers with a...
3
by: harhaiko | last post by:
Hello, I have 4,4 million rows of data in one column. I want to search for a string in each line. There are random amount of characters before the string I want to find. The string starts with the...
2
by: ad | last post by:
I have a string vaiable like "1a3345"; How to separate the string into a char array or a string array just have on character per element?
28
by: kfrost | last post by:
I know this is probably simple but I have a C# form and the class for the form is called sbaSynch. I have a textbox name txtServerName. I'm creating a class to manipulate XML functions so I...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
1
by: drec | last post by:
I have a very simple mysql/php script that is being used to store program keys in a db for multiple users. I would like to add the ability to send these string values to another application. In...
2
by: colleen1980 | last post by:
Hi: Can any one please tell me how do i separate city state and zip. I ask this question in previous post. But when the city name is in two words it mess up my values otherwise it works. ...
14
by: Lambda | last post by:
I'd like to create separate character pointers, pass them to a function to assign each one different value, and assign the pointers to an array. But when I try: #include <stdio.h> #include...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.