Can someone tell me how to parse part of a string? I can use the following:
<?php
$text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url);
echo $text;
?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash. I also need to parse out
parts of other strings. I know how to use Mid(), Left(), and Right() in VB,
but no clue for PHP.
Thanks in advance for the assistance. 8 22243
mimages wrote: Can someone tell me how to parse part of a string? I can use the following:
[...] I know how to use Mid(), Left(), and Right() in VB, but no clue for PHP.
check the substr() function @ http://www.php.net/substr.
--
I have a spam filter working.
To mail me include "urkxvq" (with or without the quotes)
in the subject line, or your mail will be ruthlessly discarded.
I noticed that Message-ID:
<9V************ ********@twiste r.tampabay.rr.c om> from mimages contained
the following: <?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash.
<?php
$text = str_replace("/","","$_SER VER[PHP_SELF]");
echo $text;
?>
--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
On Thu, 25 Sep 2003 14:36:53 +0100, Geoff Berrow wrote: I noticed that Message-ID: <9V************ ********@twiste r.tampabay.rr.c om> from mimages contained the following:
<?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash.
<?php $text = str_replace("/","","$_SER VER[PHP_SELF]"); echo $text; ?>
$text = array_pop(split ('/', $_SERVER['PHP_SELF']));
echo $text;
Just as another example.. although not tested for efficiency =)
Regards,
Ian
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.ne t | irc.digiserv.ne t | forum.digiserv. net
Programming, Web design, development & hosting.
"mimages" <mi*****@NOSPAM spvision.com> wrote in message
news:9V******** ************@tw ister.tampabay. rr.com... Can someone tell me how to parse part of a string? I can use the
following: <?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash. I also need to parse out parts of other strings. I know how to use Mid(), Left(), and Right() in
VB, but no clue for PHP.
Thanks in advance for the assistance.
<?php
$text = basename($_SERV ER['PHP_SELF']);
echo $text;
?>
An noise sounding like Ian.H said: On Thu, 25 Sep 2003 14:36:53 +0100, Geoff Berrow wrote:
I noticed that Message-ID: <9V************ ********@twiste r.tampabay.rr.c om> from mimages contained the following:
<?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash.
<?php $text = str_replace("/","","$_SER VER[PHP_SELF]"); echo $text; ?>
$text = array_pop(split ('/', $_SERVER['PHP_SELF'])); echo $text;
Just as another example.. although not tested for efficiency =)
You didn't test your code works so as to answer more questions, thus improving
your efficiency
or
You didn't test the speed your code ran an vs the speed of the other to see
which was more efficient
??????
Dave.
--
I'm a dead man, and buggered to boot!
Wow, basename, I don't think I'd have thought of this one. I'll try it.
Thanks!
"medi" <me**@banjaluka .com> wrote in message
news:bk******** **@news.teol.ne t... "mimages" <mi*****@NOSPAM spvision.com> wrote in message news:9V******** ************@tw ister.tampabay. rr.com... Can someone tell me how to parse part of a string? I can use the following: <?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash. I also need to parse
out parts of other strings. I know how to use Mid(), Left(), and Right() in
VB, but no clue for PHP.
Thanks in advance for the assistance.
<?php
$text = basename($_SERV ER['PHP_SELF']); echo $text;
?>
Thanks for all the graet responses. Time to get to work trying them.
"David Gillen" <Be****@RedBric k.DCU.IE> wrote in message
news:sl******** ***********@car bon.redbrick.dc u.ie... An noise sounding like Ian.H said: On Thu, 25 Sep 2003 14:36:53 +0100, Geoff Berrow wrote:
I noticed that Message-ID: <9V************ ********@twiste r.tampabay.rr.c om> from mimages contained the following:
<?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash.
<?php $text = str_replace("/","","$_SER VER[PHP_SELF]"); echo $text; ?>
$text = array_pop(split ('/', $_SERVER['PHP_SELF'])); echo $text;
Just as another example.. although not tested for efficiency =) You didn't test your code works so as to answer more questions, thus
improving your efficiency
or You didn't test the speed your code ran an vs the speed of the other to
see which was more efficient
??????
Dave. --
I'm a dead man, and buggered to boot!
Yup, sure enough, this is what I was looking for.
Thanks!
"mimages" <mi*****@NOSPAM spvision.com> wrote in message
news:Bf******** ************@tw ister.tampabay. rr.com... Wow, basename, I don't think I'd have thought of this one. I'll try it. Thanks!
"medi" <me**@banjaluka .com> wrote in message news:bk******** **@news.teol.ne t... "mimages" <mi*****@NOSPAM spvision.com> wrote in message news:9V******** ************@tw ister.tampabay. rr.com... Can someone tell me how to parse part of a string? I can use the following: <?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?>
to get this result:
"Your currently at /test.php "
I just want to get "test.php " without the dash. I also need to parse out parts of other strings. I know how to use Mid(), Left(), and Right()
in VB, but no clue for PHP.
Thanks in advance for the assistance.
<?php
$text = basename($_SERV ER['PHP_SELF']); echo $text;
?>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rdraider |
last post by:
Is there a function that will extract part of a string when the data you
want does not occur in a specific position?
Field "REF" is varchar(80) and contains an email subject line and the email
recipients contact name
Example data:
Rec_ID REF
1 Here is the information you requested (oc:Johm
Smith)
2 Thanks for attending our seminar (oc:Peggy Sue
Johnson)
|
by: nboutelier |
last post by:
Scenario: you enter "foo bar" into a text field... Is it possible
through javascript to select/highlight just "foo"?
formObject.select()
selects all. I need to select only part of the string. -Nick
|
by: ad |
last post by:
I have a string like
string myString="dog,cat,dog,tiger"
I want to delete the duplication part, and make myString to "dog,cat,tiger"
How can I do that?
|
by: Keith Kowalski |
last post by:
I am passing in a string of varied length
Example1: mil2345_23.lst
Example2: mil23456_1.lst
Example3: mil5567_1234.lst
What I need is to parse out all text after the _ (underscore) and before the
..)
From example 1 I need "23" returned
From example2 I need "1" Returned
From Example3 I need "12345" returned
|
by: Piotr |
last post by:
Hi,
Im trying to write a query which takes part of the string for example:
peter_Poland
michael_Germany
I wish to get output:
peter
michael
| |
by: Alpha |
last post by:
Hi, I'm able to make connection to a server using socket connection.
However, when I send a command string the server just ignores it. All
command string needs to start with "0xF9" at Byte 0. During the run-time
debug, I see it to be "u" with a "~" on top of it. Is that OxF9? Can
someone tell me what I'm doing wrong?
Thanks, Alpha
private void Connect(String server, String message)
{
//Socket Connect
|
by: MMiGG |
last post by:
Hi
Our project need parse JAVA serialized object string in C, has any library?
Thanx
|
by: Mike9900 |
last post by:
I need to get 00021 in "00sddsd00021dsd" and then increment it to become
"00sddsd00022dsd". Is there a way?
--
Mike
|
by: Terry Olsen |
last post by:
I have an app that makes decisions based on string content. I need to make
sure that a string does not contain only spaces or newlines. I am using the
syntax 'Trim(String)" and it works fine. I thought I'd change it to the VB
..NET method "String.Trim" but that throws an object exception.
Which brings the question: is it compliant to use Trim(String), or is it
more within etiquette to use If Not String Is Nothing Then String.Trim?
|
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...
|
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,...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |