tag:blogger.com,1999:blog-78678393761938225002024-02-08T11:48:35.837-08:00php php phpPHP Help !Unknownnoreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7867839376193822500.post-78858572139805712282007-01-26T06:39:00.001-08:002007-01-26T06:39:49.386-08:00php - chr function<h1>chr</h1><span style="font-weight: bold;">(PHP 3, PHP 4, PHP 5)</span><br />chr -- Return a specific character<br /><span style="font-weight: bold;">Description</span><br />string chr ( int ascii )<br /><br />Returns a one-character string containing the character specified by ascii.<br /><br /><span style="font-weight: bold;">Example 1:</span><br /><?php<br />$str .= chr(27); /* add an escape character at the end of $str */<br /><br />/* Often this is more useful */<br /><br />$str = sprintf("The string ends in escape: %c", 27);<br />?>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-7867839376193822500.post-16569343690478079302007-01-25T22:00:00.000-08:002007-01-25T22:17:56.534-08:00php - chop function<h1><a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop</a></h1><span style="font-weight: bold;">(PHP 3, PHP 4, PHP 5)</span><br /><a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop</a> -- Alias of rtrim()<br /><span style="font-weight: bold;">Description</span><br /><br />This function is an alias of: rtrim().<br /><br />Note: <a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop()</a> is different than the Perl <a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop() function</a>, which removes the last character in the string.<br /><br /><span style="font-weight: bold;">Example 1:<br /></span>To get a perl style <a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop</a>():<br /><span style="color: rgb(255, 0, 0);"><?php<br /><span style="color: rgb(255, 0, 0);">$foo = "bar";</span><br /><span style="color: rgb(255, 0, 0);">$foo = substr("$foo", 0, -1);</span><br /><span style="color: rgb(255, 0, 0);">echo $foo;</span><br /><br /><span style="color: rgb(0, 153, 0);">//returns "ba" (removes last character)</span><br /><span style="color: rgb(255, 0, 0);">?><br /><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">Example 2:<br /></span></span></span><span style="color: rgb(255, 0, 0);"><?php</span><br /><span style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(255, 0, 0);"> <span style="color: rgb(255, 0, 0);">$str = "i am best !\n\n";</span><br /><span style="color: rgb(255, 0, 0);">echo $str; <span style="color: rgb(0, 153, 0);">// displaying value before <a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop function</a></span></span><br /><span style="color: rgb(255, 0, 0);">echo <a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop</a>($str); <span style="color: rgb(0, 153, 0);">// displaying value with <a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop</a></span></span></span></span><a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html"><span style="color: rgb(0, 153, 0);"> function</span></a><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 0, 0);"><br /><span style="color: rgb(255, 0, 0);">?></span><br /><br /><span style="font-weight: bold;">Out Put Will Be :(HTML)</span><br /><html<<br /><body<<br />i am best !<br /><br />i am best !</body<<br /></html<<br /><span style="color: rgb(0, 153, 0);">In the above example <a href="http://phpphpphp.blogspot.com/2007/01/php-chop-function.html">chop function</a> has removed "\n\n"</span><br /><br /><span style="font-weight: bold;">Page Out Put Will Be :</span> i am best !i am best !</span><span style="color: rgb(0, 0, 0); font-weight: bold;"><br /></span></span><span style="font-weight: bold;"></span></span></span>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-7867839376193822500.post-48428910283288033382007-01-24T22:39:00.000-08:002007-01-24T22:43:18.201-08:00php - bin2hex function<h1>bin2hex<br /></h1><span style="font-weight: bold;">(PHP 3 >= 3.0.9, PHP 4, PHP 5)</span><br />bin2hex -- Convert binary data into hexadecimal representation<br /><span style="font-weight: bold;">Description</span><br />string bin2hex ( string str )<br /><br />Returns an ASCII string containing the hexadecimal representation of str. The conversion is done byte-wise with the high-nibble first.Unknownnoreply@blogger.comtag:blogger.com,1999:blog-7867839376193822500.post-217499294178226092007-01-24T22:18:00.000-08:002007-01-24T22:34:10.044-08:00php - addslashes function<h1>addslashes</h1><span style="font-weight: bold;">(PHP 3, PHP 4, PHP 5)</span><br /><a href="http://phpphpphp.blogspot.com/2007/01/php-addslashes-function.html">addslashes</a> -- Quote string with slashes<br /><span style="font-weight: bold;">Description</span><br />string <a href="http://phpphpphp.blogspot.com/2007/01/php-addslashes-function.html">addslashes</a> ( string str )<br /><br />Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).<br /><br />An example use of <a href="http://phpphpphp.blogspot.com/2007/01/php-addslashes-function.html">addslashes</a>() is when you're entering data into a database. For example, to insert the name O'reilly into a database, you will need to escape it. Most databases do this with a \ which would mean O\'reilly. This would only be to get the data into the database, the extra \ will not be inserted. Having the <a href="http://phpphpphp.blogspot.com/">PHP</a> directive magic_quotes_sybase set to on will mean ' is instead escaped with another '.<br /><br />The <a href="http://phpphpphp.blogspot.com/">PHP</a> directive magic_quotes_gpc is on by default, and it essentially runs <a href="http://phpphpphp.blogspot.com/2007/01/php-addslashes-function.html">addslashes</a>() on all GET, POST, and COOKIE data. Do not use <a href="http://phpphpphp.blogspot.com/2007/01/php-addslashes-function.html">addslashes</a>() on strings that have already been escaped with magic_quotes_gpc as you'll then do double escaping. The function get_magic_quotes_gpc() may come in handy for checking this.<br /><br /><span style="font-weight: bold;">Example (1):<br /></span><span style="color: rgb(255, 0, 0);"><?php</span><br /><span style="color: rgb(255, 0, 0);">$str = "Is your name O'reilly?";</span><br /><br /><span style="color: rgb(0, 153, 0);">// Outputs: Is your name O\'reilly?</span><br /><span style="color: rgb(255, 0, 0);">echo <a href="http://phpphpphp.blogspot.com/2007/01/php-addslashes-function.html">addslashes</a>($str);</span><br /><span style="color: rgb(255, 0, 0);">?> </span>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-7867839376193822500.post-11490298584936069952007-01-24T21:37:00.000-08:002007-01-24T21:53:36.379-08:00php - addcslashes function<h1>addcslashes</h1><span style="font-weight: bold;">(PHP 4, PHP 5)</span><br />addcslashes -- Quote string with slashes in a C style<br /><span style="font-weight: bold;">Description</span><br />string addcslashes ( string str, string charlist )<br /><br />Returns a string with backslashes before characters that are listed in charlist parameter. If charlist contains characters \n, \r etc., they are converted in C-like style, while other non-alphanumeric characters with ASCII codes lower than 32 and higher than 126 converted to octal representation.<br /><br />Be careful if you choose to escape characters 0, a, b, f, n, r, t and v. They will be converted to \0, \a, \b, \f, \n, \r, \t and \v. In <a href="http://phpphpphp.blogspot.com/">PHP</a> \0 (NULL), \r (carriage return), \n (newline) and \t (tab) are predefined escape sequences, while in C all of these are predefined escape sequences.<br /><br />charlist like "\0..\37", which would escape all characters with <a href="http://phpphpphp.blogspot.com/">ASCII</a> code between 0 and 31.<br /><br /><span style="font-weight: bold;">Example (1):<br /><br /></span><br /><span style="color: rgb(255, 0, 0);"><?<a href="http://phpphpphp.blogspot.com">php</a></span><br /><span style="color: rgb(255, 0, 0);">echo <a href="http://phpphpphp.blogspot.com/2007/01/php-addcslashes-function.html">addcslashes</a>('foo[ ]', 'A..z');</span><br /><span style="color: rgb(0, 153, 0);">// output: \f\o\o\[ \]</span><br /><span style="color: rgb(0, 153, 0);">// All upper and lower-case letters will be escaped</span><br /><span style="color: rgb(0, 153, 0);">// ... but so will the [\]^_` and any tabs, line</span><br /><span style="color: rgb(0, 153, 0);">// feeds, carriage returns, etc.</span><br /><span style="color: rgb(255, 0, 0);">?><br /><br /><br /></span>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-7867839376193822500.post-82877794782312948082007-01-24T21:08:00.000-08:002007-01-24T22:38:19.609-08:00Welcome to HelpWelcome to PHP phpphpphp.blogspot.com : Your <a href="http://phpphpphp.blogspot.com/">PHP Help</a> Center!<br /><br />This website exists to provide you with information to use while learning or developing <a href="http://phpphpphp.blogspot.com/">PHP</a> and <a href="http://help-mysql.blogspot.com">MySQL</a>. If you need <a href="http://phpphpphp.blogspot.com/">PHP Help</a> or you would like to provide <a href="http://phpphpphp.blogspot.com/">PHP Help</a> to other developers, you are in the right place. Additionally, we offer Apache Help, <a href="http://help-mysql.blogspot.com">MySQL Help</a>, Javascript Help, CSS Help, XML Help and much more.<br /><br />This is a community website and we ask that you join to gain access to our interactive features and also assist others by sharing your knowledge about <a href="http://phpphpphp.blogspot.com">PHP</a> and <a href="http://help-mysql.blogspot.com">MySQL</a>.Unknownnoreply@blogger.com