Re: [PHP-DB] Help in tokenizing a string
Thanx!! It worked perfectly George - Original Message - From: "David Sullivan" <[EMAIL PROTECTED]> To: "George Lioumis" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, February 01, 2002 11:51 AM Subject: Re: [PHP-DB] Help in tokenizing a string > I'm not sure why that isn't working, but this might do what you want: > > $index = strrpos($im_file, "\\"); > $im = substr($im_file, $index + 1, strlen($im_file)); > > > I just tested it out here and that works fine, $im = "image.jpg" > > On February 1, 2002 02:41 am, you wrote: > > Good day to all. > > > > I tried the following code from PHP's manual > > > > if (isset($submit)) > > { > > if ($submit == "Save") > > { > > echo "$im_file"; > > $tok = strtok($im_file, "\\"); > > while ($tok) > > { > > echo "$tok"; > > $tok = strtok ("\\"); > > } > > } > > } > > > > I have the string $im_file ="C:image.jpg" and I want to have > > into a variable (say it $im) just the filename part (image.jpg). > > The code above, returns me just a "C:" :(( > > > > Any suggestions greatly appreciated. > > -- > Dave Sullivan > Web: http://asliver.ath.cx/ > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Help in tokenizing a string
I'm not sure why that isn't working, but this might do what you want: $index = strrpos($im_file, "\\"); $im = substr($im_file, $index + 1, strlen($im_file)); I just tested it out here and that works fine, $im = "image.jpg" On February 1, 2002 02:41 am, you wrote: > Good day to all. > > I tried the following code from PHP's manual > > if (isset($submit)) > { > if ($submit == "Save") > { > echo "$im_file"; > $tok = strtok($im_file, "\\"); > while ($tok) > { > echo "$tok"; > $tok = strtok ("\\"); > } > } > } > > I have the string $im_file ="C:image.jpg" and I want to have > into a variable (say it $im) just the filename part (image.jpg). > The code above, returns me just a "C:" :(( > > Any suggestions greatly appreciated. -- Dave Sullivan Web: http://asliver.ath.cx/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Help in tokenizing a string
Good day to all. I tried the following code from PHP's manual if (isset($submit)) { if ($submit == "Save") { echo "$im_file"; $tok = strtok($im_file, "\\"); while ($tok) { echo "$tok"; $tok = strtok ("\\"); } } } I have the string $im_file ="C:image.jpg" and I want to have into a variable (say it $im) just the filename part (image.jpg). The code above, returns me just a "C:" :(( Any suggestions greatly appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]