Replacing part of a string? |
Replacing part of a string? |
sekinto |
Jan 25 2008, 04:44 PM
Post
#1
|
Group: Members Posts: 5 Joined: 20-January 08 Member No.: 4,757 |
How would I take a string such as "<stuff stuff="stuff" stuff="stuff" height="127" width="946"></stuff>" and change the height and width values using PHP?
|
Brian Chandler |
Jan 26 2008, 04:46 AM
Post
#2
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Use the PHP manual ( http://php.net ); put "strings" in the search box, look for functions, find list of string functions, find the one you want...
But a better place to start is not with the pregenerated string, but with a function that generates the element you want (what _is_ stuff?), with parameters including the width and height: function imglink($filename, $alttext, $width, $height) { ... echo "... height=\"$height\" width=\"$width\" ...."; } sort of thing. A more explicit question would be easier to answer. |
Lo-Fi Version | Time is now: 23rd April 2024 - 11:40 PM |