note 110571 added to function.explode

From: Date: Thu, 08 Nov 2012 13:42:50 +0000
Subject: note 110571 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-191809@lists.php.net to get a copy of this message
Since version 5.4 I think (Won't work on 5.3.x), you can do this: <?php $fileName = explode( '.' , 'file.bin' ) [0] . '.txt'; print_r( $fileName ); // file.txt ?> Which will get the part 0 of the returned array without the need for asigning it first and then getting the first part: <?php $fileName = explode( '.' , 'file.bin' ); $fileName = $fileName[0] . '.txt'; print_r( $fileName ); // file.txt ?> ---- Server IP: 69.147.83.199 Probable Submitter: 186.182.178.250 ---- Manual Page -- http://www.php.net/manual/en/function.explode.php Edit -- https://master.php.net/note/edit/110571 Del: integrated -- https://master.php.net/note/delete/110571/integrated Del: useless -- https://master.php.net/note/delete/110571/useless Del: bad code -- https://master.php.net/note/delete/110571/bad+code Del: spam -- https://master.php.net/note/delete/110571/spam Del: non-english -- https://master.php.net/note/delete/110571/non-english Del: in docs -- https://master.php.net/note/delete/110571/in+docs Del: other reasons-- https://master.php.net/note/delete/110571 Reject -- https://master.php.net/note/reject/110571 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191809) next »