Sagewire Logo

to extract word

4 Message(s) by 4 Author(s) originally posted in php language


From: artev Date:   Tuesday, October 02, 2007
if by PHP_SELF
I have some similar:
/localhost/namefile.php
is possible to extract only this :
namefile.php

(is possible also have only namefile -no extension-)

or is there a specific function?


From: Ian Hobson Date:   Wednesday, October 03, 2007
wrote in message:
if by PHP_SELF
I have some similar:
/localhost/namefile.php
is possible to extract only this :
namefile.php
(is possible also have only namefile -no extension-)
or is there a specific function?



First thing to do is to get clear on what EXACTLY you want to do. This
helps in programming tremendously.

If you want to extract everything following the last "/" up to, but not
including the next ".", then look up regular expressions and preg_match
in the manual.

If you want to divide the string up at every "/" and take the last, look
up "explode" and "count" in the manual.

But I'd actually start by understanding what $_SERVER['PHP_SELF']
returns. This is a predefined variable, and you can find it under that
name in the manual.

Regards

Ian


From: Olaf Schinkel Date:   Wednesday, October 03, 2007
Hello!

"artev" <mailnotspammm@xxxxxxxxxxx> schrieb im Newsbeitrag

if by PHP_SELF
I have some similar:
/localhost/namefile.php
is possible to extract only this :
namefile.php
(is possible also have only namefile -no extension-)
or is there a specific function?



What you are lloking for ist: explode

step-by-step:
$array = explode("/", $PHP_SELF);
$x = count($array);
$phpfile = $array[$x-1];
Best
Olaf


From: Thomas Mlynarczyk Date:   Wednesday, October 03, 2007
Also sprach artev:

/localhost/namefile.php
is possible to extract only this :
namefile.php
(is possible also have only namefile -no extension-)
or is there a specific function?



You are looking for basename() and/or pathinfo().

Greetings,
Thomas



Next Message: ActiveRecord pattern


Blogs related to to extract word

And indeed We created man (Adam) out of an extract of clay (water ...
is an answer to an implicit oath in the ayah as if it were to be said as “By Allah, We have created man from an essence and extract taken from mud." Referring to the word “man” in the ayah, Ibn - Abbas said, "He is Adam because he came ...

Help! Homework using Strings
Write a program that reads a string containing exactly four words, (separated by * symbols) into a single string object. Next, extract each word from the original string and store each word in a string object. Then concatenate the words ...

Easily Create and Even Edit PDF Files
The wonderful thing about the PDF is that just about anyone can read it, which isn't always the case with documents created in a word processor. While a lot of people have Microsoft Word, not everyone does, and not everyone that does ...

CHAPTER 11 UBUNTU REPLACEMENTS FOR WINDOWS PROGRAMS (Graphic web ...
Archive Manager To extract files from an archive, select them (hold down the Ctrl key to select more than one file), and then click the Extract button on the toolbar. To create an archive, start Archive Manager and click the New button. ...

Worldwide Lexicon : Adding Collaborative Translation To Your Site
The best way to demo WWL is to use our Word Press plug in. This is easy to install and will give you an idea of how WWL works from end to end. Setting up the WP plug in is simple. Just download the plug in, extract the files into your ...

How to start blogging in 10.000 words
At least, your hosting plan has to include PHP support and a MySQL database, which both is required to run WordPress. These features are kind of a standard, so most hosting plans do include both. Reliability of your hosting is even more ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional