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
https://forums.phpfreaks.com/topic/47560-solved-explodeinterger-question/
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]);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.