Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, how can I delete a part from an array? I want to search in the array to the first 5 characters, after that I want to delete the value from the array! ## Before $example = array( 1 => '1001,sastu', 2 => '1003,dudaa', 3 => '1006,s1001fd', 4 => '1008,empdat', 5 => "1010,limaad", ); ##after searching for "1006," the record must be deleted! $example = array( 1 => '1001,sastu', 2 => '1003,dudaa', 4 => '1008,empdat', 5 => "1010,limaad", ); Thnx, InseCo
Post Follow-up to this messageHi! I suggest that your script run over the array, and use fnmatch (or preg) to know whether it's the one what it wants to find. Best regards Titan InSeCo wrote: > Hello, > > how can I delete a part from an array? > > I want to search in the array to the first 5 characters, after that I want > to delete the value from the array! > > ## Before > $example = array( > 1 => '1001,sastu', > 2 => '1003,dudaa', > 3 => '1006,s1001fd', > 4 => '1008,empdat', > 5 => "1010,limaad", > ); > > ##after searching for "1006," the record must be deleted! > $example = array( > 1 => '1001,sastu', > 2 => '1003,dudaa', > 4 => '1008,empdat', > 5 => "1010,limaad", > ); > > Thnx, > InseCo > > > > > > >
Post Follow-up to this messageHi! I suggest that your script run over the array, and use fnmatch (or preg) to know whether it's the one what it wants to find. Best regards Titan InSeCo wrote: > Hello, > > how can I delete a part from an array? > > I want to search in the array to the first 5 characters, after that I want > to delete the value from the array! > > ## Before > $example = array( > 1 => '1001,sastu', > 2 => '1003,dudaa', > 3 => '1006,s1001fd', > 4 => '1008,empdat', > 5 => "1010,limaad", > ); > > ##after searching for "1006," the record must be deleted! > $example = array( > 1 => '1001,sastu', > 2 => '1003,dudaa', > 4 => '1008,empdat', > 5 => "1010,limaad", > ); > > Thnx, > InseCo > > > > > > >
Post Follow-up to this messageHi! I suggest that your script run over the array, and use fnmatch (or preg) to know whether it's the one what it wants to find. Best regards Titan InSeCo wrote: > Hello, > > how can I delete a part from an array? > > I want to search in the array to the first 5 characters, after that I want > to delete the value from the array! > > ## Before > $example = array( > 1 => '1001,sastu', > 2 => '1003,dudaa', > 3 => '1006,s1001fd', > 4 => '1008,empdat', > 5 => "1010,limaad", > ); > > ##after searching for "1006," the record must be deleted! > $example = array( > 1 => '1001,sastu', > 2 => '1003,dudaa', > 4 => '1008,empdat', > 5 => "1010,limaad", > ); > > Thnx, > InseCo > > > > > > >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.