Jump to content

[SOLVED] Explode/Interger Question


schme16

Recommended Posts

I'm wanting php to explode a file name that has numbers at the end...mostly I want the numbers gone...so if there's another way around it I'd love to hear it...

 

 

This is what I got so far:

     

                 $file_1 = explode('.',$file); //Gets rid of the .extension
                 $file_1 = explode(int,$file_1[0]); // failed attempt at removing the numbers. 

 

 

Link to comment
Share on other sites

I've found a rather ungraceful approach to it:

 

 

<?php
$file_1 = explode('.',$file);
	$file_1 = explode((0),$file_1[0]);
	$file_1 = explode((1),$file_1[0]);
	$file_1 = explode((2),$file_1[0]);
	$file_1 = explode((3),$file_1[0]);	
			$file_1 = explode((1),$file_1[0]);
	$file_1 = explode((4),$file_1[0]);
	$file_1 = explode((5),$file_1[0]);			 

	$file_1 = explode((6),$file_1[0]);
	$file_1 = explode((7),$file_1[0]);
	$file_1 = explode((,$file_1[0]);	
			$file_1 = explode((1),$file_1[0]);
	$file_1 = explode((9),$file_1[0]);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.