473,788 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ 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 1254
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($wordsepa rate); $i++){
echo "$wordsepar ate[$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($wordsepa rate); $i++){
echo "$wordsepar ate[$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
2637
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
1796
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 other box using javascript. Every option in the list has an integer value. The FORM is submitted with the POST method and received on an ASP page. I then want to manage the selected options one by one. How can I separate them?
3
1881
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 structure like this : x.xx.xxx.xxxx. Now, this numbers are between an <a href> tag and if i clic on one of this, i call a javascript function, the idea is to put each one number separate for the "." in a textbox, so i did it before but putting it
3
10571
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 letter "V" and I also know that after the letter V comes seven digits or letters which I want to find also. After that string there are random amount of characters. What kind of query I should create to find all those strings within my data? I...
2
34569
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
4379
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 added a class to project and it's named XmlApi(). In the XmlAPI() class I have simple code as following XmlAPI() { string str = "Some Text";
12
2795
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 both the iis and sql server in a single machine. Not too long ago, the machine had some hardware problems, and management has decided to purchase new servers, for both asp.net and sql server.
1
1238
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 doing some research it looks like the VB function SendKeys is what I would like to be able to do using PHP. Simply copy and pasting these values will not work, because the string is 20 + characters long, and the applications where these strings...
2
2322
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. CityStateZip ------------- Las Vegas NA, 12345 Oradell NJ, 07649 Bay Shore NY, 11703
14
1980
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 <string.h> int main(void)
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10118
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8995
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4074
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 we have to send another system
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.