Search
 
SCRIPT & CODE EXAMPLE
 

PHP

twig replace some chars by *

{% macro redact(topSecret) %}
    {% set length = topSecret|length - 4 %}
    {{ topSecret|slice(0, 3) }}{% for i in 0..length %}*{% endfor %}
{% endmacro %}

{# You have to import from _self if the macro is declared in the same file. #}
{% import _self as sharpie %}

{{ sharpie.redact('Top secret information') }}
{# => Top******************* #}
Comment

PREVIOUS NEXT
Code Example
Php :: laradock ext-ldap 
Php :: str slug laravel 
Php :: write if and else in one line laravel 
Php :: get am/pm from date in php 
Php :: php delete all files in folder 
Php :: get information from another website 
Php :: php random string generator 
Php :: laravel table data types 
Php :: php get current datetime mysql format 
Php :: delete folder laravel 
Php :: Syntax error or access violation: 1071 La clé est trop longue. Longueur maximale: 1000 
Php :: +1 month php 
Php :: php remove after character 
Php :: twig if else 
Php :: php get ip to location 
Php :: avoid php self exploit 
Php :: php string mayusculas 
Php :: wordpress if is in category 
Php :: laravel response redirect 
Php :: first character uppercase php 
Php :: Disable wordpress wp cron 
Php :: how get the first item in foreach in laravel 
Php :: php int to string 
Php :: phpstorm serial key 2020.2.3 
Php :: laravel between dates 
Php :: var_dump beautify 
Php :: php remove span tags from string 
Php :: laravel db does not exists 
Php :: parsefloat php 
Php :: Get the number of days between two dates in PHP 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =