Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
Source: When to use self vs this -stackoverflow
Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
Source: When to use self vs this -stackoverflow
###1. What’s the difference between " self " and " this " ?
Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
Source: When to use self vs this -stackoverflow
| <?php | |
| /* | |
| Objectives: | |
| - Create PHP script that will translate input data to expected output from example below. | |
| - Calculate time complexity of your script | |
| bonus: Implement solution that will not use pass-by-reference and will not use objects | |
| */ | |
| $input = [ | |
| 'A' => 1, |
| const request = require('request') | |
| const cheerio = require('cheerio') | |
| const urls = [ | |
| 'https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&anliegen[]=120686&dienstleisterlist=122210,122217,122219,122227&herkunft=http%3A%2F%2Fservice.berlin.de%2Fdienstleistung%2F120686%2F', | |
| 'https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&dienstleister=122210&anliegen[]=120686&herkunft=1', | |
| 'https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&dienstleister=122217&anliegen[]=120686&herkunft=1', | |
| 'https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&dienstleister=122219&anliegen[]=120686&herkunft=1', | |
| 'https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&dienstleister=122227&anliegen[]=120686&herkunft=1', | |
| 'https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&anliegen[]=120686&dienstleisterlist=122231,122243&herkunft=http%3A%2F%2Fservice.berlin.de%2Fdienstleistung%2F120686%2F', |
| #!/bin/bash | |
| # Check if xidell is present (required for extracting from webpage using xpath) | |
| if ! command -v xidel &> /dev/null | |
| then | |
| printf "\n\nCould not find xidel \n\n" | |
| echo "You can install it with (on a mac):" | |
| echo "brew install xidel" | |
| exit | |
| fi |