The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Replacing part of a string?
sekinto
post 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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 23rd April 2024 - 11:40 PM