Skip to content

Tag: php

Doctrine migrations table collation

Trying to find a way to programatically create tables with certain collation, but can’t seem to find a way how to do it properly. I am using the “doctrine/doctrine-migrations-bundle”: “2.1.*@dev” and Symfony 2.3, I set up in my config.yml: It creates the database with LATIN1 char…

PHP – Echo

I want my page to display <br>Hello!. But if I use Then the <br> string is not displayed, but a newline is displayed instead. How can I fix this? Thanks Answer Use entities” OR <xmp> tag in HTML:

How can I check in PHP if 2 IPv6-Adresses are equal?

I want to check if an IP is whitelisted, but IPv6-Adresses can have different representations: For example 2001:0DB8:0:0:1::1 is the short form of 2001:0db8:0000:0000:0001:0000:0000:0001. Thus, string comparison doesn’t work. How can I know two adresses are equal? Answer Use inet_pton. (However, this wi…

PHP- Get current locale

I am setting the locale of the website using this function: function set_locale($locale) { // ie. en, es $language = $locale; putenv(“LANG=”.$language); setlocale(LC_ALL, $language); …

Extract a row by value from php array

This is my array: How can I extract a row by SocketDecimal? For example: I want to extract row where SocketDecimal = 50 and make new an array only with that row. Answer $newArr will contain the desired “row”. Of course you can manipulate the if-statement depending on which “row” (I&#82…