Convert a date format in PHP [duplicate]

Use strtotime() and date(): $originalDate = “2010-03-21”; $newDate = date(“d-m-Y”, strtotime($originalDate)); (See the strtotime and date documentation on the PHP site.) Note that this was a quick solution to the original question. For more extensive conversions, you should really be using the DateTime class to parse and format πŸ™‚

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac

Update – As stated in some of the comments, running brew cleanup could possibly fix this error, if that alone doesn’t fix it, you might try upgrading individual packages or all your brew packages. I just had this same problem. Upgrading Homebrew and then cleaning up worked for me. This error likely showed up for … Read more

How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?

Difference between == and === The difference between the loosely == equal operator and the strict === identical operator is exactly explained in the manual: Comparison Operators β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Example β”‚ Name β”‚ Result β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚$a == $b β”‚ Equal β”‚ TRUE if $a is equal to $b after type juggling. β”‚ β”‚$a === … Read more

How to Create Multiple Where Clause Query Using Laravel Eloquent?

In Laravel 5.3 (and still true as of 7.x) you can use more granular wheres passed as an array: $query->where([ [‘column_1’, ‘=’, ‘value_1’], [‘column_2’, ‘<>’, ‘value_2′], [COLUMN, OPERATOR, VALUE], … ]) Personally I haven’t found use-case for this over just multiple where calls, but fact is you can use it. Since June 2014 you can … Read more

How to read a large file line by line?

You can use the fgets() function to read the file line by line: $handle = fopen(“inputfile.txt”, “r”); if ($handle) { while (($line = fgets($handle)) !== false) { // process the line read. } fclose($handle); }