Selecting A Word In Php String
Started by mostafatalebi, Nov 17 2012 07:57 AM
4 replies to this topic
#1
Posted 17 November 2012 - 07:57 AM
Hello every one
I want to write an extensive database for my upcoming bilingual dictionary. I must make my words in a notepad or a text file, and since this job is done by a typist rather than a programmer, I have to tell her to type in a simple format so that using php, later, I could add them to a database. My approach is that to tell her to type words with one space between. Like:
Carrot Potato Bread Water Glass Head Hand Eye Ear Body
What PHP Function or regular expression I must use to get each word into a row of a table in a database?
I want to write an extensive database for my upcoming bilingual dictionary. I must make my words in a notepad or a text file, and since this job is done by a typist rather than a programmer, I have to tell her to type in a simple format so that using php, later, I could add them to a database. My approach is that to tell her to type words with one space between. Like:
Carrot Potato Bread Water Glass Head Hand Eye Ear Body
What PHP Function or regular expression I must use to get each word into a row of a table in a database?
Visual Effects Programming
Autodesk Maya, Autodesk Mudbox, Nvidia Mental Images Mental Ray, Adobe Photoshop, Adobe Illustrator, Adobe After Effects, CorelDraw
Autodesk Maya, Autodesk Mudbox, Nvidia Mental Images Mental Ray, Adobe Photoshop, Adobe Illustrator, Adobe After Effects, CorelDraw
#2
Posted 17 November 2012 - 08:10 AM
explode()
eg
eg
<?php
$line = "Carrot Potato Bread Water Glass Head Hand Eye Ear Body";
foreach (explode(' ', $line) as $word) {
echo $word . '<br />';
}
?>
Edited by Barand, 17 November 2012 - 08:10 AM.
|
|baaGrid| easy data tables - and more |
#3
Posted 17 November 2012 - 09:27 AM
Oh very clean indeed, thanks. But a question before embarking on a test. Instead of <br /> is it apt to place a mysqli set of commands? thanks
Visual Effects Programming
Autodesk Maya, Autodesk Mudbox, Nvidia Mental Images Mental Ray, Adobe Photoshop, Adobe Illustrator, Adobe After Effects, CorelDraw
Autodesk Maya, Autodesk Mudbox, Nvidia Mental Images Mental Ray, Adobe Photoshop, Adobe Illustrator, Adobe After Effects, CorelDraw
#5
Posted 17 November 2012 - 01:01 PM
thank you man. working with regular expression are just a way of fun.
Visual Effects Programming
Autodesk Maya, Autodesk Mudbox, Nvidia Mental Images Mental Ray, Adobe Photoshop, Adobe Illustrator, Adobe After Effects, CorelDraw
Autodesk Maya, Autodesk Mudbox, Nvidia Mental Images Mental Ray, Adobe Photoshop, Adobe Illustrator, Adobe After Effects, CorelDraw
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












