I have this code which is meant to turn the value of a variable into a link by turning it to lowercase and then replacing all whitespaces with -
Here is my code:
@extends('layouts.base')
@section('pageTitle', 'Login')
@section('content')
Your search results are:<br><br>
@foreach($posts as $post)
<a href="{{ strtolower(str_replace("",-, $post))}}">{{ $post }}</a><br>
@endforeach
@endsection
But I get:
ErrorException (E_ERROR)
syntax error, unexpected ',' (View: C:\xampp2\htdocs\mysite\resources\views\search\index.blade.php)
My qustion is different from PHP parse/syntax errors; and how to solve them? beacuse it is a LARAVEL error not a php SYNTAX error!The solution to my question is supposed to be:{!! strtolower(str_replace(' ', '-', $post)) !!}
.I was meant to write {!!
rather than {{
as the opening blade tags and I mean you cannot do anything like that in pure php.
` – Alex Mayo Apr 15 '19 at 14:50