Oracle Home

Oracle Home

For Everything Oracle and more

Menu

  • Home
  • Articles
  • About Me
  • Computer Book Reviews
  • New Computer Books

PHP Code

You are here: Oracle Home > PHP Code

How to remove a trailing character in a string using PHP

Use the SUBSTR command: $strWithoutLastChar = substr(“abcdef”, 0, -1); This will return “abcde”

orahome 19/09/2018 PHP Code No Comments Read more

How do I remove all characters from within curly brackets or square brackets using PHP

Use preg_replace and regular expressions. The examples below remove everything in a string that is within curly braces or square brackets. echo preg_replace(” (\[.*?\])”,”,”King Kong [2005]”); echo preg_replace(” (\(.*?\))”,”,”King Kong (Amazing Box Set)”);

orahome 19/09/201819/09/2018 PHP Code No Comments Read more

How to get the Filename out of a directory name using PHP

Use strrpos – same as strpos but in reverse. Find the last occurence of ‘/’ then move forward one position and then substr from that position onwards to the end of the string. <?php echo substr($url,strrpos($url,’/’)+1); ?>

orahome 19/09/2018 PHP Code No Comments Read more

How to set the browser timeout in PHP

If your script is too complex to finish within the standard 30 seconds you can set a new value with the function: set_time_limit(900); this sets the timeout too 900 seconds / 15 minutes.

orahome 19/09/2018 PHP Code No Comments Read more

How to find out whether a number is odd or even using PHP

$i = 10; if ( $i&1 ) { echo “$i is odd”; } else { echo “$i is even”; }

orahome 19/09/2018 PHP Code No Comments Read more

How to check whether a string contains HTML using PHP

There are two ways you can do it, one is using a regular expression the other is comparing strings. First the regular expression approach: if (preg_match(“/([\<])([^\>]{1,})*([\>])/i”, $string)) { echo “string contains html”; } And here is the other approach: if(strlen($string)

orahome 19/09/2018 PHP Code No Comments Read more

How to generate a random number in PHP

To generate a random number between 0 and 100 do this: srand((double)microtime()*1000000); echo rand(0,100);

orahome 19/09/2018 PHP Code No Comments Read more

How to insert javascript in php code

Just use PHP echo commands. <? echo “<script language=\”JavaScript\”>\n” ; echo “alert(” javascript from php “);\n” ; echo “</script>” ; ?>

orahome 19/09/2018 PHP Code No Comments Read more

How to get a user’s IP address using PHP

<? $domain = GetHostByName ( $REMOTE_ADDR ); ?>

orahome 19/09/2018 PHP Code No Comments Read more

Recent Posts

  • Find the size of directories
  • How to Solve IP address conflict on Unix or Windows
  • Delete files older than 30 days in Linux
  • Excel Countif in Oracle SQL
  • Shotcut stuck rendering at certain percentage

Categories

  • Access Functions
  • Affiliate Marketing
  • Articles
  • Book Reviews
    • MySQL Book Reviews
    • Oracle Book Reviews
    • Other Book Reviews
    • PHP Book Reviews
    • Web Marketing Book Reviews
  • Computer Book Releases
  • Computer Magazines
  • Computer Products
  • CSS Tips
  • Excel Functions
  • Javascript Code
  • MySQL Code
  • Oracle Built-in SQL Functions
  • Oracle DBA
  • Oracle Error Codes
    • EXP Error Codes
    • IMP Error Codes
    • ORA Error Codes
    • PLS Error Codes
  • Oracle Forms
  • Oracle Functions
  • Oracle Procedures
  • Oracle SQL
  • PHP Code
  • SEO Tips
  • Unix Code
  • Video Editing
  • Web Hosting

Archives

  • November 2020
  • August 2020
  • June 2020
  • May 2020
  • March 2020
  • March 2019
  • September 2018

Tag Cloud

059652708X 0596100892 0596101058 0596528000 book review computer magazine exp-00079 error code IMP-00066 mysql stored procedure programming ora-00229 error code ORA-00325 ora-00957 error code ORA-01046 ora-01226 error code ORA-01317 ora-01559 error code ORA-01646 ora-01722 ora-01747 error code ORA-01844 ora-02028 error code ORA-02141 ora-02318 error code ORA-02427 ora-02818 error code ORA-03206 ora-06032 error code ORA-06314 ora-06756 error code oracle error ora-00083 oracle error ora-00447 oracle error ora-01141 oracle error ora-01471 oracle error ora-01942 oracle error ora-02233 oracle error ora-02723 oracle error ora-04033 oracle error ora-06544 oracle error pls-00356 oracle pl/sql programming oracle set PLS-00220 pls-00451 error code PLS-00566 windows vista the definitive guide

Amazon Offers

Categories

  • Oracle SQL
  • Unix Code
  • MySQL Code
  • Oracle Functions
  • PHP Code
  • Oracle DBA
  • Oracle Procedures
  • Oracle Forms
  • ORA Error Codes
  • Computer Magazines

Pages

  • ASCII Table Lookup
  • Computer Book Reviews
  • New Computer Books
  • Oracle Database 10g
  • Oracle Employers
  • Oracle Forms
  • Oracle Jobsites
  • Oracle Reports
  • Oracle White Papers
  • Top 10 Javascript Books
  • Top 10 MySQL Computer Books
  • Top 10 Oracle Computer Books
  • Top 10 PHP Computer Books
  • Top 10 Raspberry Pi Books
  • Top 10 SEO and Internet Marketing Books
  • Unix Commands Cheat Sheet
Copyright © 2021 Oracle Home.
The owner of this website, OracleHome, is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking www.oraclehome.co.uk to Amazon properties including, but not limited to, amazon.co.uk
  • Sitemap
  • Contact us
  • Privacy Policy