Re: [PHP] substr?

2008-06-20 Thread Jason Pruim
I'l post where ever I want in my own thread Master Brown :P Maybe just to confuse people even more, I should rot_13 this e-mail :P On Jun 20, 2008, at 2:21 PM, Daniel Brown wrote: Don't top post! >:-o On Fri, Jun 20, 2008 at 7:44 AM, Jason Pruim <[EMAIL PROTECTED]> wrote: One of theses

Re: [PHP] substr?

2008-06-20 Thread tedd
At 2:21 PM -0400 6/20/08, Daniel Brown wrote: On Fri, Jun 20, 2008 at 7:44 AM, Jason Pruim <[EMAIL PROTECTED]> wrote: One of theses days I will ;) There's only one 's' in 'these'. Grammar police alert! Always do a better job than you need to do. I agree with that -- however -- if y

Re: [PHP] substr?

2008-06-20 Thread Daniel Brown
Don't top post! >:-o On Fri, Jun 20, 2008 at 7:44 AM, Jason Pruim <[EMAIL PROTECTED]> wrote: > One of theses days I will ;) There's only one 's' in 'these'. > But when you know a tool that will work and it's a simple little form that's > only going to be used by a few people occasionall

Re: [PHP] substr?

2008-06-20 Thread Jason Pruim
One of theses days I will ;) But when you know a tool that will work and it's a simple little form that's only going to be used by a few people occasionally until this business takes off and I need to upgrade stuff... explode() works just fine :P On Jun 19, 2008, at 6:18 PM, Philip Thomp

Re: [PHP] substr?

2008-06-19 Thread Philip Thompson
RTFM: http://www.php.net/strrpos Hehe =D "Find position of last occurrence of a char in a string" This avoids the extension containing multiple '.'s. ~Phil On Jun 19, 2008, at 1:02 PM, Jason Pruim wrote: Know what I found that works most reliably though? $filenameExploded = explode(".", $fi

Re: [PHP] substr?

2008-06-19 Thread Daniel Brown
On Thu, Jun 19, 2008 at 1:53 PM, Philip Thompson <[EMAIL PROTECTED]> wrote: > Does that get a different result than mine? Sorry, Phil, I hadn't even been paying much attention to the thread, and saw that it just kept going, so I sent in a suggestion. Both of our things do the exact same thing,

Re: [PHP] substr?

2008-06-19 Thread Jason Pruim
Know what I found that works most reliably though? $filenameExploded = explode(".", $filename); that way, if I have a file like this: filename.todaysdate.todaystime.extension I don't end up with the extension being: .todaysdate.todaystime.extension :) Unless I was using the substr() comman

Re: [PHP] substr?

2008-06-19 Thread Philip Thompson
Does that get a different result than mine? ~Phil On Jun 19, 2008, at 10:44 AM, Daniel Brown wrote: Try this: echo substr($filename,(strrpos($filename,'.') + 1),strlen($filename))."\n"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/un

Re: [PHP] substr?

2008-06-19 Thread Daniel Brown
Try this: -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] substr?

2008-06-19 Thread Philip Thompson
On Jun 17, 2008, at 8:01 AM, Dan Shirah wrote: The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from

Re: [PHP] substr?

2008-06-19 Thread Peter Ford
Jim Lucas wrote: Peter Ford wrote: Frank Arensmeier wrote: 17 jun 2008 kl. 22.14 skrev Jim Lucas: Jason Pruim wrote: Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip fil

Re: [PHP] substr?

2008-06-18 Thread Jim Lucas
Peter Ford wrote: Frank Arensmeier wrote: 17 jun 2008 kl. 22.14 skrev Jim Lucas: Jason Pruim wrote: Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 20

Re: [PHP] substr?

2008-06-18 Thread Peter Ford
Frank Arensmeier wrote: 17 jun 2008 kl. 22.14 skrev Jim Lucas: Jason Pruim wrote: Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know

Re: [PHP] substr?

2008-06-18 Thread Frank Arensmeier
17 jun 2008 kl. 22.14 skrev Jim Lucas: Jason Pruim wrote: Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it

Re: [PHP] substr?

2008-06-17 Thread Jim Lucas
Jason Pruim wrote: Hi everyone, I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they get HUGE file

Re: [PHP] substr?

2008-06-17 Thread Daniel Brown
On Tue, Jun 17, 2008 at 8:39 AM, Jason Pruim <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I am attempting to adopt some code to work more reliably then how it is > now... > > What I am doing is coding a upload form where people could be uploading .zip > files in excess of 200 MB... Yes I know that

Re: [PHP] substr?

2008-06-17 Thread tedd
At 9:01 AM -0400 6/17/08, Dan Shirah wrote: > The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension

Re: [PHP] substr?

2008-06-17 Thread Stut
On 17 Jun 2008, at 14:04, Jason Pruim wrote: On Jun 17, 2008, at 9:01 AM, Dan Shirah wrote: The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), s

Re: [PHP] substr?

2008-06-17 Thread Stut
On 17 Jun 2008, at 14:05, Jason Pruim wrote: On Jun 17, 2008, at 8:46 AM, Stut wrote: On 17 Jun 2008, at 13:39, Jason Pruim wrote: I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip fil

Re: [PHP] substr?

2008-06-17 Thread Dan Shirah
Jason, If you don't expressly need it to run server side, you could always use a simple little javascript check if you want. * function checkFileType() { // for mac/linux, else assume windows if (navigator.appVersion.indexOf('Mac') != -1 || navigator.appVersion.indexOf('Linux') != -1) v

Re: [PHP] substr?

2008-06-17 Thread Jason Pruim
On Jun 17, 2008, at 8:46 AM, Stut wrote: On 17 Jun 2008, at 13:39, Jason Pruim wrote: I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is

Re: [PHP] substr?

2008-06-17 Thread Jason Pruim
On Jun 17, 2008, at 9:01 AM, Dan Shirah wrote: The code I'm having issues with is this: $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension

Re: [PHP] substr?

2008-06-17 Thread Dan Shirah
> > The code I'm having issues with is this: > >$filename = $_FILES['userfile']['name']; // Get the name of the file > (including file extension). >$ext = substr($filename, strpos($filename,'.'), > strlen($filename)-1); // Get the extension from the filename. > > All I want to do is

Re: [PHP] substr?

2008-06-17 Thread Stut
On 17 Jun 2008, at 13:39, Jason Pruim wrote: I am attempting to adopt some code to work more reliably then how it is now... What I am doing is coding a upload form where people could be uploading .zip files in excess of 200 MB... Yes I know that is large, but it's for a print shop and they

Re: [PHP] substr and UTF-8

2006-08-30 Thread Michael B Allen
On Wed, 30 Aug 2006 21:46:18 +0700 "Peter Lauri" <[EMAIL PROTECTED]> wrote: > function is_utf8_start($b) { > return (($b & 0x80) == 0) || ($b & 0x40); > } > [/snip] > > :) I think I will go with the mb_substr function, it works for me :) Yeah, I guess that's the right thing to do. Othe

RE: [PHP] substr and UTF-8

2006-08-30 Thread Peter Lauri
[snip] Actually this is false. I don't know what I was thinking. The high bit will be set in all bytes of a UTF-8 byte sequence. If it's not it's an ASCII character. The bytes are actually layed out as follows [1]: U- ___ U-007F: 0xxx U-0080 ___ U-07FF: 110x

Re: [PHP] substr and UTF-8

2006-08-30 Thread Michael B Allen
On Wed, 30 Aug 2006 10:08:36 -0400 Michael B Allen <[EMAIL PROTECTED]> wrote: > On Wed, 30 Aug 2006 18:34:20 +0700 > "Peter Lauri" <[EMAIL PROTECTED]> wrote: > > > Hi group, > > > > I want to limit the number of characters that are shown in a script. The > > characters happen to be Thai, and the

Re: [PHP] substr and UTF-8

2006-08-30 Thread Michael B Allen
On Wed, 30 Aug 2006 18:34:20 +0700 "Peter Lauri" <[EMAIL PROTECTED]> wrote: > Hi group, > > I want to limit the number of characters that are shown in a script. The > characters happen to be Thai, and the page is encoded in UTF-8. Everything > works, except when I want to cut the text (just take

Re: [PHP] substr and UTF-8

2006-08-30 Thread Jochem Maas
Peter Lauri wrote: > Hi group, > > I want to limit the number of characters that are shown in a script. The > characters happen to be Thai, and the page is encoded in UTF-8. Everything > works, except when I want to cut the text (just take start of string). > > I do: > > echo substr($thaistring,

Re: [PHP] Substr by words

2005-10-29 Thread Richard Lynch
On Sat, October 29, 2005 6:36 am, Danny wrote: > I need to extract 50 words more or less from a description field. How > can i > do that?. Substr, cuts the words. Is there any other way to that, > without > using and array? I mean and implemented function in PHP 4.x > I´ve been googling around, b

Re: [PHP] Substr

2004-10-25 Thread M. Sokolewicz
split() uses the POSIX regular expressions engine, and thus also uses regular expressions. The loading of this engine is a massive overhead when dealing with simple splitting of a string. To do basic things like this it's a lot faster to use explode(). - Tul Francisco M. Marzoa Alonso wrote: Yo

RE: [PHP] Substr

2004-10-25 Thread Graham Cossey
What about using explode()? $array = explode('_', 'pid_1_date_2004_10_25'); $pid = $array[1]; $yr = $array[3]; $mn = $array[4]; $dy = $array[5]; Graham > -Original Message- > From: Shaun [mailto:[EMAIL PROTECTED] > Sent: 25 October 2004 14:00 > To: [EMAIL PROTECTED] > Subject: [PHP] Subs

Re: [PHP] Substr

2004-10-25 Thread Francisco M. Marzoa Alonso
You can also use split function if you do not know about regular expressions and do not want to learn: $string = "pid_1_date_2004_10_25"; $regs = split ("_", $string ); print_r ($regs); ?> I think its autoexplicative. Shaun wrote: Hi, I have a string as follows: pid_1_date_2004_10_25 pid tells m

Re: [PHP] Substr

2004-10-25 Thread Francisco M. Marzoa Alonso
Use regular expresions: $string = "pid_1_date_2004_10_25"; preg_match ( '/^pid_(.*?)_date_(.*?)$/', $string, $regs ); print_r ($regs); ?> Shaun wrote: Hi, I have a string as follows: pid_1_date_2004_10_25 pid tells me the Project_ID and date tells me the date(!). I need to extract this informatio

Re: [PHP] Substr

2004-10-25 Thread raditha dissanayake
Shaun wrote: However, to get the Project ID I need to extract everything after 'pid_' and everything before 'date_'. Can someone help me with this please as PHP doesn't seem to provide a function for extracting information from a string that occurs before the 'needle'? yes it doe. look under re

Re: [PHP] substr ?

2003-08-17 Thread John W. Holmes
John Taylor-Johnston wrote: Sorry, scrap that: if (substr_count($mystring,"¶") >0) John Taylor-Johnston wrote: How can I find out if $mystring includes the character "¶"? Thought substr would do it? J strpos() would be better... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/

Re: [PHP] substr ?

2003-08-16 Thread John Taylor-Johnston
Sorry, scrap that: if (substr_count($mystring,"¶") >0) John Taylor-Johnston wrote: > How can I find out if $mystring includes the character "¶"? > Thought substr would do it? > J -- John Taylor-Johnston - "If it's not o

Re: [PHP] substr() on part an ereg() capture

2003-03-26 Thread Justin French
A that makes more sense!! Am trying everyone's suggestions now... Justin French on 27/03/03 3:32 AM, Marek Kilimajer ([EMAIL PROTECTED]) wrote: > Forgot to mention this is to be run after > eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", " href=\"\\1://\\2\\3\" {$t}\">\

Re: [PHP] substr() on part an ereg() capture

2003-03-26 Thread Marek Kilimajer
Forgot to mention this is to be run after eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str); as it only replaces long strings within tags Marek Kilimajer wrote: $str = preg_replace('|(]*>[^<]{55})[^<]+()|','$1...$2', $str); Justin French wrote: Hi, I have

Re: [PHP] substr() on part an ereg() capture

2003-03-25 Thread Marek Kilimajer
$str = preg_replace('|(]*>[^<]{55})[^<]+()|','$1...$2', $str); Justin French wrote: Hi, I have this ereg to turn URLs into links: eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str); ... found it in the manual i think, or maybe on weberdev.com examples Anyh

RE: [PHP] substr() on part an ereg() capture

2003-03-25 Thread Boaz Yahav
Looks like this one : http://examples.weberdev.com/get_example.php3?count=1567 so if someone manages to get this done, i would appreciate it if he can add a comment. thanks berber -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 3:24 PM To:

Re: [PHP] substr() on part an ereg() capture

2003-03-25 Thread skate
couldn't you just do substr( $blah, 0, 55) or something similar? (i'm crap with syntax, so that's just off my head...) -skate- fatcuban.com - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "php" <[EMAIL PROTECTED]> Sent: Tuesday, March 25, 2003 1:24 PM Subject: [PHP]

RE: [PHP] substr() help

2003-02-07 Thread Van Andel, Robbert
Try this $temp = fgets($fp,4096); $line = substr($temp,0,10); Robbert van Andel -Original Message- From: Paul Reilly [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 9:06 AM To: [EMAIL PROTECTED] Subject: [PHP] substr() help working on a peice of code that should be pretty

Re: [PHP] substr?

2002-06-18 Thread Chris Knipe
> When working with Boolean expressions in this way, deMorgan's laws often come in handy; these state that: > > !a AND !bis the same as !(a OR b) > !a OR !b is the same as !(a AND b) > > Hope this helps!! I don't know who this deMorgan dude is, but that rule is being wri

RE: [PHP] substr?

2002-06-18 Thread Ford, Mike [LSS]
> -Original Message- > From: Chris Knipe [mailto:[EMAIL PROTECTED]] > Sent: 17 June 2002 09:28 > > Is this right? It seems to me that substr is working in reverse? > > $string = "1234567890"; // Always numerical, always 10 chars. > if (!substr($string, 0, -7) == "083") { > echo "not 0

RE: [PHP] substr?

2002-06-18 Thread Ford, Mike [LSS]
> -Original Message- > From: Lazor, Ed [mailto:[EMAIL PROTECTED]] > Sent: 17 June 2002 21:24 > To: 'Chris Knipe'; [EMAIL PROTECTED] > Subject: RE: [PHP] substr? > > > Here's another way of writing that code that may be easier to > work with: &

RE: [PHP] substr....what does this mean? (newbie)

2002-05-21 Thread Scott Hurring
-1 is the index of the char number you want to examine. http://www.php.net/manual/en/function.substr.php So that code is checking the last char of the string to see if its ".", if it is, it returns everything *except* the ".". Please consult the online manual in the future... it wants to be you

RE: [PHP] Substr and HTML tags - Problem...

2002-02-25 Thread Jon Haworth
> Personally when I'm doing teasers I strip all HTML from the content > before using substr: > > $teaser = strip_tags($content); > $teaser = substr($teaser, 0, 100); > $teaser .= '...'; // Nice touch to have a '...' on the end :) > You don't have a handy way to check that your substr() doe

Re: [PHP] Substr and HTML tags - Problem...

2002-02-25 Thread Simon Willison
Sascha Ragtschaa wrote >I need to limit a teaser-text via substr($teaser,0,100). The Problem I now >have is, if the last 4 string chars are a html tag like and this tag >will be cut by the substr to something like that: webpage... > >How can I avoid that the html tags are cut by the substr funct

Re: [PHP] substr trim functions..

2001-12-14 Thread jimtronic
There are no shortage of ways to do this. // Using explode() ... echo array_pop(explode(" ",$full_name)); // Using split() ... echo array_pop(split(" ",$full_name)); // Using stristr() while($haystack = stristr($haystack," ")) { $haystack = substr($haystack,1); $last_wo

Re: [PHP] substr trim functions..

2001-12-14 Thread Nicolas Costes
$pos=strpso($line," "); $last=substr($line, $pos, strlen($line)); http://www.php.net/manual/en/function.substr.php http://www.php.net/manual/en/function.strpos.php http://www.php.net/manual/en/function.strlen.php @+++ Le Vendredi 14 Décembre 2001 17:11, Andras Kende a écrit : > I trying to con

Re: [PHP] substr() in MySQL SELECT?

2001-09-19 Thread Tom Churm
hi, don: thanks a lot for the tip. and thanks even more for echoing the poor tone i used in my post--i will try to avoid writing such posts in the future. after looking at the documentation (many connection problems today), i was able to write this, like i wanted: SELECT User, SendDate FROM $tab

RE: [PHP] substr() in MySQL SELECT?

2001-09-19 Thread Don Read
On 19-Sep-2001 Tom Churm wrote: > hi, > > could someone please tell me why this doesn't work? i thought that > string functions could be used in select statements? i dunno... > > SELECT User, SendDate FROM my_form > WHERE substr(SendDate, 0, 2)=19; > > and i've tried the damn thing with bra

Re: [PHP] substr question...

2001-07-27 Thread Ryan Fischer
You wrote: > I am trying to receive file names but can't quite figure out the proper > substr to do it: > > jeff.dat > jeffrey.dat > chris.dat > tom.dat > > I want to receive the name to the left of the .dat > > Jeff $file = array("jeff.dat", "jeffrey.dat", "chris.dat", "tom.dat"); for($i=0; $i\n

Re: [PHP] substr question...

2001-07-26 Thread Jeff Lewis
RE: [PHP] substr question...I suppose that $tmpmember=substr($entry, 0,-4); will do the same? :) Jeff - Original Message - From: Boget, Chris To: 'Jeff Lewis' ; [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 3:54 PM Subject: RE: [PHP] substr question... >

RE: [PHP] substr question...

2001-07-26 Thread Boget, Chris
> I am trying to receive file names but can't quite figure out > the proper substr to do it: > jeff.dat > jeffrey.dat > chris.dat > tom.dat > I want to receive the name to the left of the .dat $fileName = eregi_replace( "\.dat", "", $fullFileName ); Chris

Re: [PHP] substr question...

2001-07-26 Thread Unni
try $filename=explode(".", names); echo $filename[0] Jeff Lewis wrote: > I am trying to receive file names but can't quite figure out the proper substr to do >it: > > jeff.dat > jeffrey.dat > chris.dat > tom.dat > > I want to receive the name to the left of the .dat > > Jeff > -- PHP Ge