PhpStorm Tips, ticks and standard setup
- Tips and Tracks for PHPStorm (PHPStorm Tips and Tricks.md)
- Standard setup for PHP projects (Standard.md)
<?php | |
/** | |
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended | |
* to the end of the array. | |
* | |
* @param array $array | |
* @param string $key | |
* @param array $new | |
* |
<?php | |
$array = array_map("str_getcsv", explode("\n", $csv)); | |
print json_encode($array); |
// create a bookmark and use this code as the URL, you can now toggle the css on/off | |
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3 | |
javascript: (function() { | |
var elements = document.body.getElementsByTagName('*'); | |
var items = []; | |
for (var i = 0; i < elements.length; i++) { | |
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) { | |
items.push(elements[i]); | |
} | |
} |
<?php | |
<?php | |
///amo integra begin | |
$values = $hook->getValues(); | |
$subject = $modx->getOption('emailSubject', $formit->config, 'form-'.$modx->resource->get('emailSubject')); | |
$name = $values['name']; | |
$phone = $values['phone']; | |
$email = $values['email']; | |
<?php | |
// Buffer all upcoming output... | |
ob_start(); | |
// Send your response. | |
echo "Testing response"; | |
// Get the size of the output. | |
$size = ob_get_length(); |
public function request_queue_handler(Request $request) | |
{ | |
header($_SERVER['SERVER_PROTOCOL'].' 200 OK'); | |
$amo_subdomain = $_POST['account']['subdomain']; | |
$path_structure = '../'.$amo_subdomain.'/queue_files'; | |
$queue_file_prefix = $path_structure.'/queue_file_'; | |
$queue_flag_file = $path_structure.'/queue_flag'; | |
$lead_name = $_POST['leads']['add'][0]['name']; |
<?php | |
// Buffer all upcoming output... | |
ob_start(); | |
// Send your response. | |
echo "Testing response"; | |
// Get the size of the output. | |
$size = ob_get_length(); |
@php | |
$d = $d ?? null; // default value | |
@endphp | |
<div class="form-group row"> | |
<label for="{{ $n }}" class="col-sm-4 col-form-label text-md-right"><b>{{ $l }}</b></label> | |
<div class="col-md-8"> | |
<input id="{{ $n }}" type="checkbox" class="form-control" name="{{ $n }}" value="1" @if(old($n, $d) == '1') checked @endif> | |
@if ($errors->has($n)) | |
<small class="text-danger">{{ $errors->first($n) }}</small> |