How to extract number from string in PHP

In PHP, you can extract numbers from a string using regular expressions and the `preg_match_all()` function. Here's an example of how to extract all numbers from a string: ```php $my_string = "There are 15 Oranges and 3 Bananas."; preg_match_all('/[0-9]+/', $my_string , $matches); print_r($matches[0]); ``` This will output: ```php Array ( [0] => 15 [1] => 3 ) ``` **Explanation:** - The regular expression `/[0-9]+/` searches for one or more consecutive digits. - The `preg_match_all()` function searches the string for all occurrences of the regular expression and stores the matches in...
Read More


How to run jQuery in the Chrome dev console

During front end development we mostly use jQuery and so its good to know that how can we run jQuery queries from **chrome** or other **chromium browsers** or other browser which offer developer console like **Mozilla Firefox**, **Microsoft Edge** etc. So first open your browser developer console from chromium browser settings or press **`CONTROL + SHIFT + I`** Then execute the following queries in it. ```js var MyjQuery= document.createElement('script'); MyjQuery.src = "https://code.jquery.com/jquery-3.3.1.min.js"; document.getElementsByTagName('head')[0].appendChild(MyjQuery);...
Read More


Search
SPONSOR
CRYPTOWATCH
FOLLOW US
SPONSOR